Skip to content

Commit 45448f4

Browse files
authored
Merge pull request #2 from aJantes/master
串口延时显示
2 parents a225b32 + 1683e4c commit 45448f4

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

02.inputs/ts.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
uart.write('hello world')
8+
while True:
9+
recvlen = uart.any()
10+
if time.time() % 5 == 0:
11+
if recvlen > 0:
12+
time.sleep_ms(1000)
13+
print('------')
14+
buffer = uart.read(recvlen)
15+
uart.write(buffer)
16+
print(buffer)

0 commit comments

Comments
 (0)