当前位置:网站首页>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
边栏推荐
- 使用晨曦记账本,分析某个时间段每个账户收支结余
- logstash 7. There is a time problem in X. the difference between @ timestamp and local time is 8 hours
- Ionic 从创建到打包指令集顺序
- Spark performance optimization guide
- Rust: shared variable in thread pool
- 【ACM】376. 摆动序列
- Rust: how to implement a thread pool?
- Mysqldump backup database
- kettle庖丁解牛第17篇之文本文件输出
- Daily CISSP certification common mistakes (April 18, 2022)
猜你喜欢

On iptables

Imx6 debugging LVDS screen technical notes

CANopen STM32 transplantation

How to restore MySQL database after win10 system is reinstalled (mysql-8.0.26-winx64. Zip)

Use bitnami / PostgreSQL repmgr image to quickly set up PostgreSQL ha

纠结

ctfshow-web362(SSTI)

【ACM】455. 分发饼干(1. 大饼干优先喂给大胃口;2. 遍历两个数组可以只用一个for循环(用下标索引--来遍历另一个数组))

硬核解析Promise对象(这七个必会的常用API和七个关键问题你都了解吗?)

QT reading and writing XML files (including source code + comments)
随机推荐
Can filter
Halo 开源项目学习(七):缓存机制
Const keyword, variable and function are decorated with const
Interpretation and compilation of JVM
Deep learning classic network analysis and target detection (I): r-cnn
Daily network security certification test questions (April 14, 2022)
Test questions of daily safety network (February 2024)
纠结
Daily network security certification test questions (April 12, 2022)
Using transmittablethreadlocal to realize parameter cross thread transmission
深度学习经典网络解析目标检测篇(一):R-CNN
14个py小游戏源代码分享第二弹
Daily CISSP certification common mistakes (April 18, 2022)
Introduction to QT programming
Use Chenxi bookkeeping book to analyze the balance of revenue and expenditure of each account in a certain period of time
Introduction to quantexa CDI syneo platform
Teach you to quickly rename folder names in a few simple steps
Setting up keil environment of GD single chip microcomputer
Introduction to quantexa CDI syneo platform
登录和发布文章功能测试