hello,
at first excuse me for my english,
i have a question i use wire library to trasmit between 2 arduinos and i don't know if i can trasmit an integer value. if i can, how i can do it?
thank you
hello,
at first excuse me for my english,
i have a question i use wire library to trasmit between 2 arduinos and i don't know if i can trasmit an integer value. if i can, how i can do it?
thank you
I would imagine you can send anything, but only a byte at a time.
So you would get the number and use mod & div to split the number up.
here is an example:
Wire.send((byte)(integerValue >>8)); // sends the most significant byte
Wire.send((byte)(integerValue & 0xff)); // sends the least significant byte
the receiving side has to reconstruct the integer
val = Wire.receiver() << 8; // get the msb
val += Wire.receive(); // get the lsb
thank you very much