Skip to content

Instantly share code, notes, and snippets.

@bboyho
Created October 16, 2019 05:55
Show Gist options
  • Save bboyho/2cde4bbda2a85579c148c398b3e0daec to your computer and use it in GitHub Desktop.
Save bboyho/2cde4bbda2a85579c148c398b3e0daec to your computer and use it in GitHub Desktop.
Test of Teensy XBee Adapter
//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(5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment