XBee and Mega


apologies if relatively simple question, rather new arduino's , cannot seem find concise information on topic.



this xbee, mounted on shield , placed onto mega 2560. want leave serial usb debugging , use serial1 xbee communication. how do this?

just confirm, 2 xbee's communicate if use softwareserial.   this code works using softwareserial:
code: [select]
#include <softwareserial.h>
 
// xbee's dout (tx) connected pin 10 (arduino's software rx)
// xbee's din (rx) connected pin 11 (arduino's software tx)
softwareserial serial1(10, 11); // rx, tx
boolean nextline = false;
void setup()
{
  serial.begin(9600);
  serial1.begin(9600);
}
 
void loop()
{
   while(serial1.available()){ // there data being sent xbee
    char read = char(serial1.read());
    if(read == 'a'){
      //where ~ eot character
      serial1.write("55.134~");
    }
  }
}


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > XBee and Mega


arduino

Comments