当前位置:网站首页>K210 serial communication
K210 serial communication
2022-04-23 18:33:00 【Scroll monster】
One 、 Serial port configuration
from machine import UART # Import UART modular
fm.register(9, fm.fpioa.UART1_TX, force=True) #9 by tx Pick up rx
fm.register(10, fm.fpioa.UART1_RX, force=True) #10 by rx Pick up tx
uart_A = UART(UART.UART1, 9600, 8, 1, 0, timeout=1000, read_buf_len=4096)
Basically, it is to configure the pin of serial port and the setting of serial port parameters .
Two 、 Serial port sends data
Serial port sends data call uart_A.write() that will do .
3、 ... and 、 Serial port receives data
Serial port receiving data call uart_A.read() that will do . Pay attention to mxai py Byte stream data received in , You need to convert bytes into strings and remove the terminator to use the received data ( If it is necessary to use data to judge )
if uart_A.any():
while uart_A.any():
read_data = uart_A.read()
read_data = read_data.decode('utf-8','ignore') # To string
if read_data[0] == 'b': # section
.....
read_data = ''
版权声明
本文为[Scroll monster]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231826029023.html
边栏推荐
- Differences between SSD hard disk SATA interface and m.2 interface (detailed summary)
- Promote QT default control to custom control
- iptables初探
- QT reading and writing XML files (including source code + comments)
- STM32 learning record 0008 - GPIO things 1
- Custom prompt box MessageBox in QT
- Introduction to QT programming
- ctfshow-web362(SSTI)
- Correct opening method of option
- 软件测试总结
猜你喜欢
os_authent_prefix
Notepad + + replaces tabs with spaces
Spark performance optimization guide
powerdesigner各种字体设置;preview字体设置;sql字体设置
Robocode tutorial 7 - Radar locking
JD-FreeFuck 京東薅羊毛控制面板 後臺命令執行漏洞
Install the yapiupload plug-in in idea and upload the API interface to the Yapi document
Robocode tutorial 3 - Robo machine analysis
kettle庖丁解牛第17篇之文本文件输出
JD-FreeFuck 京东薅羊毛控制面板 后台命令执行漏洞
随机推荐
Error reported when running tensorboard: valueerror: duplicate plugins for name projector, solution
ESP32 LVGL8. 1 - BTN button (BTN 15)
QT notes on qmap container freeing memory
CANopen STM32 transplantation
QT reading and writing XML files (including source code + comments)
【ACM】455. Distribute Biscuits (1. Give priority to big biscuits to big appetite; 2. Traverse two arrays with only one for loop (use subscript index -- to traverse another array))
【ACM】509. 斐波那契数(dp五部曲)
使用 bitnami/postgresql-repmgr 镜像快速设置 PostgreSQL HA
Const keyword, variable and function are decorated with const
ctfshow-web362(SSTI)
14个py小游戏源代码分享第二弹
硬核解析Promise對象(這七個必會的常用API和七個關鍵問題你都了解嗎?)
Daily CISSP certification common mistakes (April 15, 2022)
Kettle paoding jieniu Chapter 17 text file output
Gson fastjason Jackson of object to JSON difference modifies the field name
Introduction to quantexa CDI syneo platform
配置iptables
Daily network security certification test questions (April 15, 2022)
Feign requests the log to be printed uniformly
Using transmittablethreadlocal to realize parameter cross thread transmission