I recently purchased the book Wireless Sensor Networks by Robert Faludi. I also purchased 3 of the programmable XBee Pro S2B with 32k flash. The radios sit on an Arduino Wireless shield on an Arduino Uno R3. I load an empty setup/loop sketch onto each Arduino. The shields are toggled to USB. The radios will communicate just fine. Opening the Serial Monitor thru the IDE allows me to “chat” with each radio. They are all connected via USB to my notebook.
Now I take it up a notch. I upload this sketch to two of the router radios:
const int ledPin = 13; // the pin that the LED is attached to
int incomingByte; // a variable to read incoming serial data into
void setup() {
// initialize serial communication:
Serial.begin(9600);
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
}
void loop() {
// see if there’s incoming serial data:
if (Serial.available() > 0) {
// read the oldest byte in the serial buffer:
incomingByte = Serial.read();
// if it’s a capital H (ASCII 72), turn on the LED:
if (incomingByte == ‘H’) {
digitalWrite(ledPin, HIGH);
}
// if it’s an L (ASCII 76) turn off the LED:
if (incomingByte == ‘L’) {
digitalWrite(ledPin, LOW);
}
}
}
Then I upload this to the coordinator radio:
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print(‘H’);
delay(1000);
Serial.print(‘L’);
delay(1000);
}
I unplug the radios and switch the toggle from USB to Micro on the shield and replug them. Nothing happens. No led flashing.
I can use the IDE to manually flash the leds on the router radios thru the Serial monitor by sending H and L. I can use the IDE to see the H/L being sent on the coordinator radio thru the Serial monitor. They just aren’t talking to each other at this point.
Any opinions, ideas, clues or support would be most appreciated.
Thanks!
Thomas