Skip to main content


Reads a specified number of bytes from the serial port




Name Type Description
numberOfBytes Integer Optional number of bytes to read (default = 80)


Blob — the bytes read from the UART FIFO, or a zero-length blob if the FIFO is empty


This method reads a specified numbers of bytes from the UART’s receive FIFO and returns them as a blob. If you do not specify the number of bytes you require — the numberOfBytes parameter is optional — the method returns all of the available bytes up to the size of the FIFO itself. By default, the receive FIFO is set at 80 bytes is size. However, the size of the FIFO may be altered using UART.setrxfifosize().

If fewer bytes than requested are available, the method will return a smaller blob containing as many bytes as there were in the UART receive FIFO. If no data is available, it will return a zero-length blob.

The method does not block.