Software > Software
USB2SERIAL Converter and Processing Troubleshooting
jwatte:
The maximum value of a byte is 255. If you write a larger value, the Serial library will do one of two things:
1) Truncate it to 8 bits.
2) Send more than one byte.
3) Convert it to text format and send it as text rather than binary.
To send exactly the data you want, you should send it like so:
--- Code: ---unsigned short value = 511;
mySerial.write((void *)&value, sizeof(value));
--- End code ---
and receive it something like:
--- Code: ---if (mySerial.available() >= 2) {
unsigned short value = mySerial.read();
value = value | ((unsigned short)mySerial.read() << 8u);
.. use 'value' for the dynamixel ..
}
--- End code ---
Navigation
[0] Message Index
[*] Previous page
Go to full version