UsbReadln connection, data$

This command reads character bytes from a specified USB serial connection until a newline character "\n" is encountered. Any data read is returned in the data$ parameter. The newline character is not included in the string returned. If no data is available to read an empty string will be returned. It is important to note that only the lower eight bits of each character is read. This is a good function for receiving regular string records. This command should be used to receive a string sent by a UsbWriteln command.

After a UsbReadln 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