Created
October 16, 2019 05:55
-
-
Save bboyho/2cde4bbda2a85579c148c398b3e0daec to your computer and use it in GitHub Desktop.
Test of Teensy XBee Adapter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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