Hi all,
I think I've been sniffing too many solder fumes, because this question sound pretty straightforward, but I can't seem to figure it out.
Here's my set-up:
I have a couple sensors that pass data via UART to different Rx pins on the mega. I merely read these values, add them to an uberpacket and pass along wirelessly to the host computer on the main Tx pin on the mega. The second-to-last byte in the uberpacket is a checksum value based on all the data in the packet (last packet is line feed, dec 10). The values being read from the other sensors are ascii values, so for 10.5 I read 49 48 46 53. I'm merely passing these values directly, so my checksum is based on 49 49 46 53 (and so on). Everything works great, and can easily verify packets on the receiving machine.
No I am adding data from an analog pin on the mega to the packet. Let's say I get the value of 500 from an analog read. I'm passing this along as an int as part of my uberpacket, and on the receiving end I get 53 48 48. My problem is now calculating the checksum. On the mega it's using the value 500 for the checksum calculation, but on the receiving machine it uses 53, 48 , and 48.
I'm guessing that what I need to do is convert 500 to ascii via itoa() for the checksum? Does this sound right?
Thanks in advance for any pointers.
Best,
David