UsbSerial icon indicating copy to clipboard operation
UsbSerial copied to clipboard

Read with Length

Open tjstyle opened this issue 10 years ago • 3 comments

Hi..

are this library can read specific length like on C programming: byte[] readBuffer = serial.read(5); //to read only 5 bytes in C

Regards, TJ.

tjstyle avatar Sep 09 '16 15:09 tjstyle

Hi @tjstyle I would do it this way for reading 3 bytes for example:

byte[] buffer = new byte[3]; syncRead(buffer, 0);

felHR85 avatar Sep 13 '16 20:09 felHR85

Hi @felHR85 Thanks for your suggestion. there are any example for using sync operation for read & write?

Regards, TJ.

tjstyle avatar Sep 14 '16 17:09 tjstyle

Hi @tjstyle This weekend I've added a little example based on the previous one using the synchronous calls. https://github.com/felHR85/UsbSerial/tree/master/examplesync

Hope it helps.

felHR85 avatar Sep 22 '16 11:09 felHR85