Hi
Please can someone suggest the best way to connect and send data between two arduinos, at the moment I have them connected via and I2c link( directly wired) and tried using the wire library to send data between them but not with much success.
I would like to send int values greater than 255 between the two boards to indicate what each board is doing. along with actual sensor data like the distance to an object returned from a ultrasonic sensor as an int
e.g send the int value 2034
might represent a sensor reading of 34
the 2 indicating its a sensor reading and the following 3 digits being available for the reading itself.
Hi Richard
thanks for the reply
I have been able to send bytes across form one to the other using the wire examples supplied with the arduino.
I am strugling with how to send an int value from one to the other and decode it to an int the other side. when experimenting i carnt get passed the value 255 with the current code.
if you could tell me how to send the data and decoded it the other end that would be great. i was figuring on some basic maths to get at the data i need from the protocol.
I have supplied pretty much the example code i have only took a while loop out for reading in some txt on the reciving end
as I am unsure how to modify this to convert int to bytes to send.
and how to reconstruct them on the receiving end.
Is the wire the best command for doing this or should i be looking else where. sorry if this seams trival
Thanks for your reply
i was hoping it was going to be a bit easier than this
i figured on fixed lenght packets of ints just not sure how to transmit and reassemble them
if you could suggest the best commands for formating it would be a great help and i will go off and starting looking again and trying to get it to working
many thanks