Skip to content

Commit 1df92ee

Browse files
committed
add uart
1 parent d658023 commit 1df92ee

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

02.inputs/uart.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import time
2+
from machine import UART
3+
4+
uart = UART(2) # UART(2) RX16 TX17
5+
uart.init(57600, bits=8, parity=None, stop=1)
6+
7+
while True:
8+
recvlen = uart.any()
9+
if recvlen > 0:
10+
uart.write(uart.read(1))
11+
# uart.write("hello\n")
12+
# time.sleep(1)

0 commit comments

Comments
 (0)