logo

串口通信

2018-07-02 15:00
5
_13531193294

arduino有Serial.flush(); //清空串口缓存,那opennv有没有

2018-07-02 16:10
I
网红小智智 星瞳科技

查了一下Arduino 的文档

> Arduino里,Serial.flush(); 1.0版本之前为清空串口缓存,现在该函数作用为等待输出数据传送完毕。如果要清空串口缓存的话,可以使用:while(Serial.read() >= 0)来代替。

https://docs.singtown.com/micropython/zh/latest/openmvcam/library/pyb.UART.html#pyb-uart

找了一下文档,没找到flush。

那么,MicroPython如果要清空串口缓存:

while(uart.any()):
    uart.readchar()

如果要等待输出数据传送完毕:

这个还真不知道,也不知道有什么用。。。