Receiving Junk values at the Rx after transition

Please follow the link below
Help help me with a solution to understand why I receive junk value and also methods to read the hex value->convert to integer->use it in my function.

link

Attached is the Rx I modified

Moderator edit: raw URL converted to link.

Rx.ino (2.28 KB)

Where is the message coming from? What data was sent? What data did you actually receive?

The attached is the Tx program modified from Serial_1Tx example
It is transmitting 3 integer values (1.LDR status 2.Switch Status 3.Count) converted to hex and sent.
Used the Xbee libraries
This is where i am transmitting the data.

What i received is as follows:
127
3456789
126
3456728

and soon…

I figured it might be because i am not reading at the right pointer or the conversion has not happened. Dont know what is the exact problem.
the above attached is the Rx program.

main_tx.ino (7.22 KB)

PeterH: Where is the message coming from? What data was sent? What data did you actually receive?

Sreenu: What i received is as follows: 127 3456789 126 3456728

What was actually [u]sent[/u]?

There seems to be a lot of redundant code in the receiver, but I'm guessing this is the statement which produced the output you showed:

Serial.println(unite1,unite2,unite3);

I'm surprised that compiled since the documentation for Serial doesn't describe a three-arg version of println(), and I don't know what it does, but what it [u]doesn't[/u] do is print out the three arguments.

Try something like this:

Serial.print("unite1=");
Serial.println(unite1);
Serial.print("unite2=");
Serial.println(unite2);
Serial.print("unite3=");
Serial.println(unite3);

And print out the values you're actually sending. It's futile trying to validate what you received if you don't know what was actually sent.

Thanks :)