Our Arduino code:
#include <SoftwareSerial.h>// XBee's DOUT (TX) is connected to pin 2 (Arduino's Software RX)// XBee's DIN (RX) is connected to pin 3 (Arduino's Software TX)SoftwareSerial XBee(2, 3); // RX, TXbool closed = false;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. XBee.begin(9600); Serial.begin(9600); pinMode(13, OUTPUT);}void loop(){ if (XBee.available()) { // If data comes in from XBee, send it out to serial monitor //char c = XBee.read(); //Serial.write(c); if (XBee.read() != '0') { closed = true; } else closed = false; } digitalWrite(13, closed ? HIGH : LOW);} |
Photos and great Starbuck for today!
