当前位置:网站首页>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
边栏推荐
- STM32: LCD显示
- 昇腾 AI 开发者创享日全国巡回首站在西安成功举行
- ESP32 LVGL8. 1 - BTN button (BTN 15)
- MATLAB小技巧(6)七种滤波方法比较
- Log4j2 cross thread print traceid
- MATLAB从入门到精通(二)
- 回路-通路
- According to the result set queried by SQL statement, it is encapsulated as JSON
- 玻璃体中的硫酸软骨素
- Gson fastjason Jackson of object to JSON difference modifies the field name
猜你喜欢

Resolves the interface method that allows annotation requests to be written in postman

使用晨曦记账本,分析某个时间段每个账户收支结余

Install the yapiupload plug-in in idea and upload the API interface to the Yapi document

The vivado project corresponding to the board is generated by TCL script

With the use of qchart, the final UI interface can be realized. The control of qweight can be added and promoted to a user-defined class. Only the class needs to be promoted to realize the coordinate

Multifunctional toolbox wechat applet source code

Solution to Chinese garbled code after reg file is imported into the registry

logstash 7. There is a time problem in X. the difference between @ timestamp and local time is 8 hours

Kettle paoding jieniu Chapter 17 text file output

ESP32 LVGL8. 1 - label (style 14)
随机推荐
视频边框背景如何虚化,简单操作几步实现
SQL database syntax learning notes
Multifunctional toolbox wechat applet source code
Robocode Tutorial 4 - robocode's game physics
Error reported when running tensorboard: valueerror: duplicate plugins for name projector, solution
Using transmittablethreadlocal to realize parameter cross thread transmission
根据快递单号查询物流查询更新量
JD-FreeFuck 京東薅羊毛控制面板 後臺命令執行漏洞
Win1远程出现“这可能是由于credssp加密oracle修正”解决办法
Hard core parsing promise object (do you know these seven common APIs and seven key questions?)
The connection of imx6 network port is unstable after power on
ctfshow-web362(SSTI)
Robocode tutorial 8 - advanced robot
Correct opening method of option
函数递归以及趣味问题的解决
Robocode tutorial 7 - Radar locking
【ACM】70. climb stairs
STM32 learning record 0008 - GPIO things 1
昇腾 AI 开发者创享日全国巡回首站在西安成功举行
Daily CISSP certification common mistakes (April 14, 2022)