logo

为什么我串口想传输两位数,它却理解成两个一位数?

2024-04-07 20:30
U
by4o
c43568b5-9783-4e54-9a3b-f7482e33bc0a.png
2024-04-10 19:36
I
网红小智智 星瞳科技

应该要多加一个timeout参数,另外发送的时候要加换行”55,66\n“

import time
from pyb import UART
uart = UART(3, 9600, timeout_char=1000, timeout=1000)

while True:     
    if uart.any():
        print(uart.readline().decode().split(","))