当前位置:网站首页>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
边栏推荐
- Cygwin64 right click to add menu, and open cygwin64 here
- Feign requests the log to be printed uniformly
- 【ACM】70. 爬楼梯
- 机器学习实战 -朴素贝叶斯
- powerdesigner各种字体设置;preview字体设置;sql字体设置
- The connection of imx6 network port is unstable after power on
- MATLAB小技巧(6)七种滤波方法比较
- QT error: no matching member function for call to ‘connect‘
- Halo open source project learning (VII): caching mechanism
- 玻璃体中的硫酸软骨素
猜你喜欢
MATLAB从入门到精通(二)
【ACM】509. Fibonacci number (DP Trilogy)
Robocode tutorial 5 - enemy class
ctfshow-web362(SSTI)
The vivado project corresponding to the board is generated by TCL script
CANopen STM32 transplantation
纠结
Matlab tips (6) comparison of seven filtering methods
Stm32mp157 wm8960 audio driver debugging notes
机器学习理论之(7):核函数 Kernels —— 一种帮助 SVM 实现非线性化决策边界的方式
随机推荐
【ACM】70. climb stairs
Daily CISSP certification common mistakes (April 12, 2022)
【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))
纠结
串口调试工具cutecom和minicom
ctfshow-web362(SSTI)
Ucosiii transplantation and use, reference punctual atom
Introduction to quantexa CDI syneo platform
ESP32 LVGL8. 1 - event (event 17)
Use Chenxi bookkeeping book to analyze the balance of revenue and expenditure of each account in a certain period of time
How to virtualize the video frame and background is realized in a few simple steps
配置iptables
CISSP certified daily knowledge points (April 15, 2022)
Mysqldump backup database
Deep learning classic network analysis and target detection (I): r-cnn
SQL database syntax learning notes
Domestic GD chip can filter
Keil RVMDK compiled data type
Differences between SSD hard disk SATA interface and m.2 interface (detailed summary)
Use stm32cube MX / stm32cube ide to generate FatFs code and operate SPI flash