Can't get XBee to work

Hi everyone,

I’m having a tough time getting my Xbees to communicate. I’m using a teensy 3.2 and the adaptor, and following these directions:

https://learn.sparkfun.com/tutorials/te … 1515125621

The code for the UART example causes an error message saying that BYTE is not declared.

I have XTCU up and running, but really don’t know what I’m doing here. If anyone can give me better code or clearer directions I would be forever grateful. I’ve spent a long time on this and am close to giving up, at this point.

Thanks!

Tom

Hi Tom,

I think that code is just out-of-date. We will work on getting the code updated and tested but in the meantime, try this:

//Serial test using the hardware uart on pins 0/1 (UART1).
//Connect an XBee and Teensy 3.1 to the adapter board
//Connect an XBee to a serial terminal of your choice (USB dongle for example)
//
//Characters sent out the XBee terminal go:
// Onto the airwaves -> into UART1 RX -> out the serial monitor
//
//Characters sent out the serial monitor go:
// Out the UART1 TX pin -> onto the airwaves -> out the SBee serial terminal
//
//Be sure to select UART1 on the adapter board's switch for HW serial

void setup()
{
  //Begin serial monitor port
  Serial.begin(9600);
  //Begin HW serial
  Serial1.begin(9600);

}

void loop()
{
  // Take data received from the serial monitor and pass it to the HW UART
  if(Serial.available())
  {
    Serial1.write(Serial.read());
  }

  // Take data received from the HW UART and pass it to the serial monitor
  if(Serial1.available())
  {
    Serial.write(Serial1.read());
  }

  //Wait to reduce serial load
  delay(10);
}

I have not tested this with hardware yet but this code should work and you should be able to send characters between your XBees. Let me know if this does not work or if you have any other questions or issues with the Teensy XBee Shield and I would be happy to help.