What I like to do is that: turn on xbee (turn on the power)->use xbee to send out message (Serial.print("hello") )-> turn off xbee (turn off the power)
The thing is that it won't work, i.e. the receiving end cannot receivce any message
Also, since serial.print() function could also print the message to the terminal, I can see the message is printed on the terminal but cannot see it from the receiver.
However, if I keep the power always on, the message could be received.
My personal guess is that when I intially do serial.print("hello"), "hello" is stored in the buffer but is not actually sent out. When next data comes, say "hi", "hello" is pushed out of the buffer and could be sent over while "hi" is stored in the buffer.
If I turn off the power after storing "hello", the data is lost.
We need to know a lot more. What are the XBees connected to? Which type of XBees are they? If they are connected to Arduinos, how and what code is being used?
I use the Arduino Wireless Proto Board to connect with Arduino UNO. The Xbee sits on the wireless proto board. I do not stake the wireless probo board directly on top of UNO, instead I used wires to connect them. I connect "5V" on Xbee shield to digital output 7 on the Ardunio board, so that my Arduino could control Xbee on or off. TX and RX are connected to Arduino TX and RX accordingly.
The xbee is communicating with the other Xbee, connected to my PC with a mini-USB cable and a sparkfun xbee shield.
The Xbee I am using is Serial 1 with IC #: 4214A-XBEE.
How are the XBees configured? Do you KNOW that they are communicating?
Hi,
Honestly I do not set up the Xbee mode(i.e. left default). I use XCTU for the xbee on my PC end, and xbee shield on the Arduino. Since this shield uses serial communication, when I do serial.print(), this message could be sent to both my Arduino terminal and XCTU terminal.
The issue I had was, I could see the message on Arudino Terminal, but it does not appear on XCTU terminal. So I think my receiver does not receive any information.
Honestly I do not set up the Xbee mode(i.e. left default). I use XCTU for the xbee on my PC end
You have a PEBKAC error.
Forget that shit that digi.com says about not needing to configure the XBees. You need to configure BOTH of them. MY on one needs to be DL on the other; neither value should be 0 or 0xFF, and PAN ID must be the same on both.
Forget that shit that digi.com says about not needing to configure the XBees. You need to configure BOTH of them. MY on one needs to be DL on the other; neither value should be 0 or 0xFF, and PAN ID must be the same on both.
And there is STILL no code.
Thanks for your reply.
My code is fairly easy, as I said before, I just use Serial.print() to transmit data.
For example,
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(5,OUTPUT); // Pin 5 is directly connected to the power supply (5V) on the Xbee shield
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(5,HIGH);
Serial.println("hello");
digitalWrite(5,LOW);
delay(3000);
}
Technically I think when I finish Serial.println("hello"); the data should be transmitted to my receiver and after this Xbee should be shut off. But on my receiver end, I cannot see any data.
Just for shits and giggles, quit turning the XBee off. Serial data is buffered, and sent using interrupts. When you turn off the broadcaster before the data has been sent, you can't really expect it to be sent, can you?