UsbRead connection, data$ {,maxBytes}

This command reads character bytes from a specified USB serial connection. Any data read is returned in the data$ parameter. If no data is available to read an empty string will be returned. An optional maxBytes parameter specifies the maximum number of bytes to read. It is important to note that only the lower eight bits of each character is read. The strings returned by this command should be thought of as containing bytes.

After each UsbRead command it is important to check if the read succeeded. All serial communication is subject to interruption at any time so check the UsbGetError$(n) after each USB command you execute. UsbGetError$(n) will return an empty string if the read succeeded.

USB Serial Communication

Become a Patron