这个接受怎么输出的有额外字符,如发111,收到b'111\r\n',我要怎么获取我发的字符呢
import time
from pyb import UART
uart = UART(3, 115200)
buf=0
while(True):
buf=uart.read()
print(buf)
time.sleep_ms(1000)
https://forum.singtown.com/topic/8784/openmv4plus%E4%B8%B2%E5%8F%A3%E6%8E%A5%E6%94%B6%E6%95%B0%E6%8D%AE%E6%9C%89%E5%89%8D%E7%BC%80-%E6%80%8E%E4%B9%88%E6%B6%88%E9%99%A4
那我要怎么获取我发的那个数据,我用下标引不出来么
@g36h
buf=uart.read()
print(len(buf))
print(buf[0])
print(buf[1])
#转成字符串
data = buf.decode()
print(data)