readBytes

We are about to test system.serial.readBytes. Would it be possible for a developer to supply a couple of lines of code as an example of how it should been implemented?

There is an outstanding bug with the serial library on 64bit machines:
viewtopic.php?f=72&t=8604

I’ve not had this working yet due to the bug, but it should look like this:

port = '/dev/ttyUSB0'
system.serial.openSerialPort(port)
system.serial.configureSerialPort(
    port,
    bitRate=system.serial.BIT_RATE_9600
)
bytes = system.serial.readBytes(port, 16)
system.serial.closeSerialPort(port)

On Unix systems it shouldn’t matter whether you open or configure first, and you can reconfigure at any time. This might not be true for other operating systems so try swapping those calls if you have problems.

Please let me know how you get on.

You beat me to the example!

This isn't true using the serial scripting functions. configureSerialPort() just modifies a SerialConfig data structure; but the actual SerialPort object doesn't listen for changes to that data structure. It's passed one when it's opened and uses the parameters configured at that point. (It does look at them again when reset() or configure() is called, but that's not exposed to the scripting API)