"""Program 4-2: Loopback test. Observe whether the receive buffer is empty. Put a jumper between the GP21 pin and the GP20 pin. """ import time from machine import UART, Pin uart1 = UART(1, baudrate = 9600, rx = Pin(21), tx = Pin(20)) m = uart1.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ") n = uart1.any() time.sleep_ms(10) p = uart1.any() time.sleep_ms(20) q = uart1.any() print (m, n, p, q)