EasyManuals Logo

XBee Shield User Manual

XBee Shield
24 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #15 background imageLoading...
Page #15 background image
void setup()
{
// Set up both ports at 9600 baud. This value is most important
// for the XBee. Make sure the baud rate matches the config
// setting of your XBee.
Serial1.begin(9600); //XBee/UART1/pins 0 and 1
Serial.begin(9600); //USB
}
void loop()
{
if (Serial.available()) //USB
{ // If data comes in from serial monitor, send it out to XBee
Serial1.write(Serial.read()); //XBee/UART1/pins 0 and 1
}
if (Serial1.available()) //XBee/UART1/pins 0 and 1
{ // If data comes in from XBee, send it out to serial monitor
Serial.write(Serial1.read()); //Serial port
}
}
Note: If you are using an Arduino Leonardo (or any ATmega32U4-based Arduino) and not a
Arduino Uno, make sure to change the switch to the hardware "UART" position. In this case, do
not need to add a jumper wire between the RST and GND pin.
What You Should See
After you've uploaded the code, follow this series of steps to verify that everything is working:
Page 15 of 24

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the XBee Shield and is the answer not in the manual?

XBee Shield Specifications

General IconGeneral
BrandXBee
ModelShield
CategoryComputer Hardware
LanguageEnglish