UART
Uart.Enable(baudRate) - Sets the baud rate UART
baudRate: Any commonly used standard baud rateUart.Read() - Read UART data
Returns: A byte read from UARTUart.Write(data) - Write UART data
data: Data byte to send on UARTUart.BytesToRead() - Count
Returns: How many bytes have been buffered and ready to be read
The example below enables UART at baudrate 115200, check how many bytes buffered, read and plus 1, then send back to sender
duelink.Uart.Enable(115200)
while True:
if (duelink.Uart.BytesToRead() > 0):
data = duelink.Uart.Read()
duelink.Uart.Write(data + 1)
time.sleep(0.1)