Hello! After hours of looking, I am hoping someone can help me. Ultimately I want to drive a tank robot wirelessly with 2 xbee’s but I am starting simple and will settle on just reading potentiometer data from a sending xbee to the receiving xbee into an arduino mega serial port and reading it on the serial monitor. Then I hope to figure out how to use the data but first:
Problem: When I read from the XCTU terminal monitor directly from the receiving xbee which is pluged into to a sparkfun USB explorer board, I get good (I think) HEX data from the sending xbee.
7E 00 0A 83 12 34 25 00 01 02 00 01 9B 72 This repeats very very fast, so fast I need to disconnect the xbee.
However when I read the data from the Arduino Mega Serial Monitor from the program below I get this HEX data from the same setup:
7E 0A 83 12 34 01 1 9b 73 Note the single “1” and not a two number byte.
Why is the data different? It should be the same?
Material:
2 Xbee series 1
Transparent mode for both
1 Arduino Mega 2560 r3
1 logic level converter.
Sender: One pot center wire connected directly to the Xbee pin 20 or AD0, the other two pot wires one to ground the other to3.3 volts.
Reveiver: Receiving Xbee conected to the logic level converter (5 volts to 3…3 to 5) then to the Arduino Mega Serial1 port Pins 18tx, 19rx. The Mega main Serial/Power conected to my computer. The Serial1 Ports on the Mega are connected to the to the Xbee Din and DOUT accordingly.
I have a simple program
int data;
void setup()
{
Serial.begin(9600);
//Serial1.begin(9600);
}
void loop()
{
if(Serial1.available() >0); // make sure at least a byte is in the buffer
data = Serial1.read();// read one byte from Serial1 port
Serial.println(data); // print that one byte from Serial1 to the Arduino Serial
// monitor screen on the computer to see the data.
delay(20); // delay 20 ms just because
}