I am working on a project that reads values from 10 DOF module. It will read three inputs (2 16 bit values and 1 24 bit value) and send them over a serial link.
Sending the values isn't a problem but they are scrambled when using serial.read, I presume because the lowest byte is sent first and then the next higher byte.
I have been reading a LOT but can't find a simple solution to put the read value back together.
I thought I could use "serial.available() = number of bytes" to tell when the proper number of bytes have been received but it always returns a compiler error:
Arduino: 1.6.13 (Windows 7), Board: "Arduino/Genuino Uno"
C:\Users\Dianne\Documents\Arduino\SerialReceiveTest\SerialReceiveTest.ino: In function 'void loop()':
SerialReceiveTest:51: error: lvalue required as left operand of assignment
- if (mySerial.available() = 1) {*
- ^*
SerialReceiveTest:57: error: lvalue required as left operand of assignment - if (Serial.available() = 2) {*
- ^*
exit status 1
lvalue required as left operand of assignment
There has GOT to be a simple way to do this! (What is it? LOL!)