大佬们 请问要怎么通过uart串口向主板发送浮点型数据
-
大佬们 请问要怎么通过uart串口向主板发送浮点型数据
-
import time from pyb import UART import struct # Always pass UART 3 for the UART number for your OpenMV Cam. # The second argument is the UART baud rate. For a more advanced UART control # example see the BLE-Shield driver. uart = UART(3, 19200) while(True): p = 3.1415 uart.write(struct.pack('<f', p))#发送小端,float,4字节 uart.write(struct.pack('<d', p))#发送小端,double,8字节 time.sleep_ms(1000)
-
@kidswong999 谢谢大佬