UART — read N characters (uart_read_num)¶
What it does: Reads the specified number of bytes from the UART and attempts to convert them to UTF‑8 text.

Inputs¶
num: number of characters/bytes to read.
Output¶
- Text, or text representation of bytes.
Noneif nothing is available.
When to use it¶
- For fixed frame length protocols.
- When you know exactly how many bytes you expect.
Tips and pitfalls¶
- For invalid UTF‑8, a string representing bytes is returned.
- If the counterparty sends less data, the result may be incomplete.
Generated Python example¶
part = read_uart(uart1, 8)