Go Down

Topic: Xbee problems (Read 1 time) previous topic - next topic

Casey Gross

Hello, im new to this forum and this post is most likely in the wrong spot but... I have been trying to figure out my xbees they are series one and ive been attempting to send the value 100 over to a different arduino. The problem is that i receive weird numbers; this is what i get back:
Ready!
6
129
0
1
59
0
100
222
126
0
6
129
0
1
59
0
100
222
126
0
6
129
0
1
62
0
100
219
126
0
6
129
0
1
63
0
100
218
126
0
6
i receive 100 every now an then but not repetitive. my baud rate is set at 19200. ANY help is appreciated.

jluciani

Are you sure that baud rate matches the XBee? IIRC the default rate is 9600.

I have a few XBee software examples at
http://wiblocks.luciani.org/ZB1/index.html

Also I have some XBee setup examples in the ZB1 datasheet
on the same page.

(* jcl *)

------------------------------------
www: http://www.wiblocks.com
twitter: http://twitter.com/wiblocks
blog: http://luciani.org


Casey Gross

Didnt seem to work now im receiving characters that make no sence like: b[ch132]:ótEó[ch132]5ó[ch133]Fø[ch133]FóEóDEóEóDóEó[ch133]Dó[ch133]b[ch132]5ó[ch132]9ó[ch132]:ó[ch132]EójFóEó¤EóEóD

is what i got back any other suggestions?

jluciani

It is strange that in the first example you always get ASCII
digits and not garbage (like the second example).
Are you sure you are always sending the string "100" ?
Are you measuring an A/D value that could be floating
and then sending the ASCII string that represents a
random result?

Can you confirm the BAUD rate of both devices with XCTU?
Is there anything else connected to the RX and TX lines?

The only other suggestion I have would be to try one of my
examples. I know these work. Just adjust the baud rates,

(* jcl *)

Casey Gross

this is the code:
transmitter:
int analogValue2, analogValue5, val2, val5;

void setup()
{
// start serial port at 19200 bps
Serial.begin(19200);
}

void loop()
{
// read analog input
analogValue2 = analogRead(2);


// remap values

val2 = map(analogValue2, 0, 1023, 253, 0);  // 254 and 255 for SYNC

Serial.print(100, DEC);

delay(150);
}

It only prints 100.

do you have a example code?

jluciani

Are you saying it is working? Only the string "100" is printed?

(* jcl *)

Casey Gross

no it's not im still receiving garbage, and i did confirm the baud.

jluciani

There are some example sketches on my site that transmit ones and zeros.

You could veriy one more thing -- with the transmitting XBee disconnected
verify the serial output using the serial monitor.

(* jcl *)

Casey Gross

Yeah i cant seem to get it going i dont know what the problem is.

Casey Gross

okay now with the xbee set to 9600 im now receiving the same number as the first post

Casey Gross

Whats weird is i receive 100 every 10th line.

jluciani

Make a simple program without the analog commands.

In the setup section one line --

Code: [Select]
Serial.begin(9600);

In the loop section one line

Code: [Select]
Serial.print("HELLO WORLD\r");

(* jcl *)

Casey Gross

how would i do the receiver code?

jluciani

Take a look at the sample code on my site.

(* jcl *)

Casey Gross

sorry man can you make a link i cant find it on there.

Go Up