# 基于openmv的串口收发 **Repository Path**: blue-net--embedded/serial-based-on-openmv ## Basic Information - **Project Name**: 基于openmv的串口收发 - **Description**: No description available - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-03-31 - **Last Updated**: 2024-04-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 基于openmv的串口收发 -作者:[何云峰](https://gitee.com/iven_he) ## 开发背景 对于**OpenMv**的**microPython**环境,无法安装第三方库,我们无法使用`serial`库发送串口,然而openmv的`pyb.UART`库无法发送整型数据,针对此问题,在代码中封装了`Serial`类继承`pyb.UART`类,直接传输**9600**波特率的数据到串口 ## 代码简介 代码中`Serial`类包含一个动态函数send_arr为外部使用,传入一个元组进行发送,发送数据包的包头为`0xb3`,包尾为`0x5b`。使用时先创建一个`Serial`对象,然后用`send_arr`发送元组 ser = Serial() ser.send_arr((245,342))