0

I'm trying to get a XBEE shield to operate on an Arduino Leonardo. Usually i use the AltSerialLibrary to emulate an extra serial for the xbee. However since the Leonardo comes with two sets of serial, i figured I use that instead.

//#include <AltSoftSerial.h>
//AltSoftSerial XBee(5,13); // RX, TX
void setup() {
 Serial1.begin(9600);
 Serial.begin(9600);
}
void loop() {
 Serial.println("Odds");
 Serial1.println("Ends");
 delay(1000);
}

The code above aims to write values to both the serial monitor (serial) and xbee (serial1). However in the Xbee's XCTU program, the remote xbee does not recieve any data.

Any feedback on how I might fix this will be appreciated.

asked Dec 23, 2014 at 7:10
2
  • How is the Xbee connected? You have a SoftSerial connection commented out, but Serial1 does not use the same pins as the SoftSerial would have. Commented Dec 23, 2014 at 18:40
  • kinda obvious question, but how did you configure the XBee previously? Commented Jan 12, 2015 at 15:43

1 Answer 1

1

You said you are using a Xbee shield. What shield is it, and what pins does it use for Serial communications?

If you were using software to emulate the second serial port on other arduinos, you were probably using different pins, and so if the shield is designed to communicate over (as an example) pins 2 and 3 then it will most likely not work with pin 0 and 1 without moving jumpers or switches. For example, this Xbee Shield: http://core-electronics.com.au/xbee-shield.html/?acc=9f61408e3afb633e50cdf1b20de6f466 has a switch to switch between pins 0 and 1 and pins 2 and 3.

You could also try some code that reads from Serial and prints the data to Serial1 and visa versa. This means you can experiment to get a greater understanding of the problem.

answered Jun 30, 2015 at 6:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.