The best way to create an AdHoc setup with this setup arduino + RN-XV + XBeeShield is to use this code (to be used also with e-Health Sensor Platform V2.0 for Arduino and Raspberry Pi from cooking hacks )
void setup(){
Serial.begin(9600);
delay(500);
Serial.print(“$$$”);check();
Serial.print(“apmode your_SSID 02\r”);check();
Serial.print(“save\r”);check();
Serial.print(“exit\r”);check();
delay(1000);
}
just add this to be able to write UDP packets
Serial.print(“set ip remote 8888\r”);
Serial.print(“set ip proto 0x1\r”);
use in the loop:
Serial.print(“whateveryouwant”);