Sharing text through XBee on Arduino -


how share text through xbee module?

i tried, instead of word, getting numbers every time. want exchange text data both sides. using arduino communication. how can fix problem?

i've been through similar problem , able work around it. assume you're using mega 2560 , have set of xbee modules connected 2 computers through sparkfun xbee usb explorer. i've included code can upload both of xbees , use them simple walkie-talkie pair. program meant read entire incoming word/string terminated defined character.

 //xbee walkie-talkies  #define endofinput '@'//define terminating character void setup() {    serial1.begin(9600); //serial thru pin 19   serial.begin(9600); //serial monitor  } string incomingword=""; //initialize null char input; //to read incoming character void loop() {   if (serial.available()>0) {     // send out whatever typed @ serial     //monitor thru xbee     serial1.write(serial.read());     }   //read entire incoming word   while(serial1.available()>0){     input = serial1.read();     if (input != endofinput) incomingword+=input;     else break;   }   //print out word received on serial monitor   serial.println(incomingword);   incomingword = ""; //reset string } 

it should pretty self-explanatory.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -