还是不对
import time
from pyb import UART
uart = UART(3, 9600)
uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters
def sending_data():
global uart
data=bytearray([0x0F,0xA2,0x52,0x09,0x01,0x01,0x60,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x69,0x03])
uart.write(data)
def recive_data():
global uart
if uart.any():
tmp_data = uart.readline()
print(tmp_data)
if tmp_data == ‘\x16\xa2\x00\x10\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11[\x03’:
while(True):
sending_data()
recive_data()
time.sleep(1000)