当前位置:网站首页>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
边栏推荐
- JD freefuck Jingdong HaoMao control panel background Command Execution Vulnerability
- Use Chenxi bookkeeping book to analyze the balance of revenue and expenditure of each account in a certain period of time
- 昇腾 AI 开发者创享日全国巡回首站在西安成功举行
- 【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
- Analysez l'objet promise avec le noyau dur (Connaissez - vous les sept API communes obligatoires et les sept questions clés?)
- Kettle paoding jieniu Chapter 17 text file output
- Win1远程出现“这可能是由于credssp加密oracle修正”解决办法
- Ionic instruction set order from creation to packaging
- Permission management with binary
猜你喜欢

昇腾 AI 开发者创享日全国巡回首站在西安成功举行

Robocode tutorial 7 - Radar locking

MATLAB从入门到精通(二)

Use stm32cube MX / stm32cube ide to generate FatFs code and operate SPI flash

Robocode tutorial 5 - enemy class

【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】376. 摆动序列

纠结

Vulnérabilité d'exécution de la commande de fond du panneau de commande JD - freefuck

Multifunctional toolbox wechat applet source code
随机推荐
Hard core parsing promise object (do you know these seven common APIs and seven key questions?)
Cygwin64 right click to add menu, and open cygwin64 here
【ACM】509. 斐波那契数(dp五部曲)
【ACM】509. Fibonacci number (DP Trilogy)
The vivado project corresponding to the board is generated by TCL script
JD-FreeFuck 京東薅羊毛控制面板 後臺命令執行漏洞
线上怎么确定期货账户安全的?
Daily CISSP certification common mistakes (April 14, 2022)
Robocode tutorial 3 - Robo machine analysis
CANopen STM32 transplantation
Function recursion and solving interesting problems
In win10 system, all programs run as administrator by default
Introduction to quantexa CDI syneo platform
Linux installs MySQL in RPM (super simple)
Gson fastjason Jackson of object to JSON difference modifies the field name
Daily network security certification test questions (April 14, 2022)
视频边框背景如何虚化,简单操作几步实现
In shell programming, the shell file with relative path is referenced
CISSP certified daily knowledge points (April 18, 2022)
Matlab tips (6) comparison of seven filtering methods