Open Bizarrus opened 4 months ago
You should check using another tool (with the same serial port settings) that the device really doesn't send zeros, just to be sure (especially because a non-zero byte 0xFC has been received as well).
This readBytes()
method is a very "core" one, I use it in my app without problems (although with TIMEOUT_READ_SEMI_BLOCKING
mode, using an older library version 2.10.2).
(Otherwise, I see no problem in your code, the reading loop is almost the same as in the offical example.)
The method
<serialPort>.readBytes(byte[] buffer, int bytesToRead)
wont fill the byte array.Version:
2.11.0
Sample
Output