Go Down

Topic: Serial comm between 2 Arduinos (Now with XBee) (Read 1 time) previous topic - next topic

Grendel

#5
Mar 24, 2011, 02:26 pm Last Edit: Mar 24, 2011, 02:36 pm by Grendel Reason: 1
Thank you so much for your help.  It appears that I need to really dig into the ASCII conversion rules.

Graynomad

#6
Mar 24, 2011, 02:41 pm Last Edit: Mar 24, 2011, 05:09 pm by Graynomad Reason: 1
0x is simply the prefix for HEX numbers so

0x10           --- HEX
16               --- Decimal
B00010000  --- Binary

Are all the same value.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Grendel


0x is simply the prefix for HEX numbers so

0x10           --- HEX
16               --- Decimal
B00010000  --- Binary

Are all the same value.

______
Rob


are


Ah, so for example "0xEE"
Format         Value
binary         B11101110
decimal         238
hexidecimal     0xEE

Awesome.  Thank you.  I understood the hex, just wasn't sure what 0x meant.

Graynomad

Quote
even the code I listed above -- which was working -- is now not working

Then something else has changed. Have you knocked a wire out or something? Or is this the classic programmer's "I didn't change anything, honest" line :)

The number of times I've said that only to then remember I made a small mod that "shouldn't affect anything".

Do you have any test equipment? You need to have a good look at what exactly is emanating from Arduino 1.

Once you are happy that the transmitter is working OK then you look at the receiver.

You need to know what is being received. Just expecting a LED to go on or off doesn't help when it's not working. The code only works for '1' and '0', you have no way of telling if any of the other 254 possibilities are being received.

Put some debug code in the receiver, like

char val = Serial.read();
Serial.print (val, BYTE);

and look at the results.

Embedded processing can be very frustrating, no doubt about that, but moving to another platform won't help. They're all the same horse, just different colours.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Grendel

Ok... I feel like an idiot now.  In my transmitter program, I have variable "val" declared as an integer, but in my argument, I put "HIGH" and "LOW" as opposed to "1" and "0".  As soon as I changed this it started "working" again.  At least I'm back to where I started so I can now move forward.

Go Up