Timeline for Receiving two-byte int values over serial
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 20, 2016 at 20:19 | comment | added | Cerin | This likely won't work as op expects. Each write(byte) transmits in separate transactions. If the master calls this with requestFrom(), it'll only receive the first byte, and never receive the second. To send both bytes, you need to pass a byte array to write(). | |
| Jul 23, 2014 at 15:00 | comment | added | Bachalo | thanks!. I've edited my original code and it works, but how do I separate out my x,y coordinates in my main loop? Serial.println(receivedValue); | |
| Jul 22, 2014 at 20:45 | comment | added | Gerben | Just to clarify. Wire.read() and Wire.write only work of single bytes. To send a 2 byte int, you need to split the int into 2 bytes, send them individually, and then join them again at the receiving end. | |
| Jul 22, 2014 at 17:18 | history | answered | user2973 | CC BY-SA 3.0 |