Hello! I'm from Brazil and this is my first post, so apologize for the bad English and also if I did something wrong.
My goal is very simple (so I think): I want to establish a xbee network with three devices.
DEVICE A: IBoard EX (http://imall.iteadstudio.com/iboard-ex.html)
Uses a xbee configured as coordinator in AT mode.
DL and DH are set to broadcast (FFFF).
DEVICE B: Arduino Uno with Open Jumper's sensor expansion shield (http://x.openjumper.com/en/sensors-shield/)
Uses a xbee configured as router in AT mode.
DL and DH are set to coordinator (0).
DEVICE C: Arduino Nano with other xbee and sd card shield (http://imall.iteadstudio.com/im120417016.html).
Uses a xbee configured as router in AT mode.
DL and DH are set to coordinator (0).
The initial idea was to make DEVICE A as a webserver, to host a web service to check and control sensors and relays at DEVICES B and C. I have no problem with the ethernet, webserver and webservice stuff, but I was not able to get the xbees working correctly.
So, I decided to simplify a little my environment for debugging proposes.
I'm just using DEVICE A and a xbee explorer connected to my PC.
I uploaded this sketch to DEVICE A:
#include <SoftwareSerial.h>
SoftwareSerial softSerial0(0,1);///RX/TX
void setup()
{
softSerial0.begin(9600);
pinMode(0,INPUT);
pinMode(1,OUTPUT);
}
void loop()
{
softSerial0.print('H');
delay(1000);
softSerial0.print('L');
delay(1000);
}
And opened X-CTU at terminal screen on my PC.
Everything works as expected. I receive all H and L at X-CTU.
But, if I type something at X-CTU, that thing does not appears at DEVICE A serial console.
That is ok, because I did not program that.
So, I uploded this sketch to Arduino:
#include <SoftwareSerial.h>
SoftwareSerial softSerial0(0,1);///RX/TX
const int ledPin = 13; // the pin that the LED is attached to
int incomingByte; // a variable to read incoming serial data into
void setup() {
Serial.begin(9600);
softSerial0.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(0,INPUT);
pinMode(1,OUTPUT);
}
void loop() {
if (softSerial0.available() > 0) {
incomingByte = softSerial0.read();
Serial.println(incomingByte);
// 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);
}
}
Serial.println(incomingByte);
delay(250);
}
It does not matter what I type at X-CTU. DEVICE A serial console only keeps showing "0".
I tried to switch my xbees, but the result was the same.
Can anyone provide some help?