当前位置:网站首页>K210 learning notes (II) serial communication between k210 and stm32
K210 learning notes (II) serial communication between k210 and stm32
2022-04-23 08:40:00 【PI Zhi of Engineering^_^】
List of articles

Preface
Want to use STM32 Give to through a serial port K210 Sending data , And show on the screen , Read several blogs , It's finally worked out , You can have a look if you are interested .
K210 Learning notes ( One ) K210 And STM32 Serial communication related
connection ,STM32 The serial port pin of is relatively fixed , and K210 It's like a cow , Arbitrary mapping , Good news for the lazy . Here I found two that have not been reused IO,IO9 and IO10
| STM32 | K210 |
|---|---|
| GND | GND |
| PA10(RXD) | IO10(TXD) |
| PA9(TXD) | IO9(RXD) |
One 、STM32 End
I use punctual atoms STM32F103ZET6 Elite board
This serial port routine needless to say , Almost all routines are self-contained serial ports 1, Don't talk much , After the main function is initialized, it can be used directly printf Print
printf("%.2f",temp_wendu);// Print

Two 、K210
k210 The end is simpler , Than 32 It's simple . It's using microPython, Grammar is Python.
After introducing the corresponding module , To initialize . One of the most important is codec ,32 The serial port over there sends byte data , In order to UTF-8 Coded , therefore K210 The end needs to be UTF-8 Decoding can display normally .
import sensor
import image
import lcd
import time
import utime
from machine import UART
from fpioa_manager import fm
fm.register(10, fm.fpioa.UART1_TX, force=True)# Mapping serial port pin
fm.register(9, fm.fpioa.UART1_RX, force=True)# Mapping serial port pin
uart = UART(UART.UART1, 115200, 8, 1, 0, timeout=1000, read_buf_len=4096)
clock = time.clock()
lcd.init()
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.run(1)
sensor.skip_frames(30)# Skip just started 30 Frame photo
lcd.rotation(2)#LCD Screen flip , The scope is 0~3
sensor.set_hmirror(True)# Camera image
while True:
img = sensor.snapshot()# Get a picture from the camera
read_data = uart.read(5)# Read serial data , Read 5 Bytes
read_data=read_data.decode('utf-8')# Conduct utf-8 decode
if uart.read()!=None:
img.draw_string(2,2, ("temp=%s" %(read_data)), color=(0, 176, 80), scale=2)
lcd.display(img)
test result
Now we can see , Successfully received serial port data , And in LCD Displayed on the . from K210 Send out STM32 It's the same . Add one \r\n That's it . Next time we can talk about .

版权声明
本文为[PI Zhi of Engineering^_^]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230759143617.html
边栏推荐
- Go语言自学系列 | golang结构体指针
- 请提前布局 Star Trek突破链游全新玩法,市场热度持续高涨
- Failed to convert a NumPy array to a Tensor(Unsupported Object type int)
- Add listening event to input element
- 洋桃电子STM32物联网入门30步笔记三、CubeMX图形化编程、设置开发板上的IO口
- word加水印
- QT reads all files under the path or files of the specified type (including recursion, judging whether it is empty and creating the path)
- HAL库的RCC简介
- synchronized 锁的基本用法
- 数据可视化:使用Excel制作雷达图
猜你喜欢

RPC procedure

'bully' Oracle enlarged its move again, and major enterprises deleted JDK overnight...

Use of Arthas in JVM tools

增强现实技术是什么?能用在哪些地方?

洋桃電子STM32物聯網入門30步筆記一、HAL庫和標准庫的區別

'恶霸' Oracle 又放大招,各大企业连夜删除 JDK。。。

洋桃电子STM32物联网入门30步笔记三、新建CubeIDE工程和设置讲解

测试你的机器学习流水线

Asan minimalism

Failed to convert a NumPy array to a Tensor(Unsupported Object type int)
随机推荐
Excle plus watermark
Star Trek强势来袭 开启元宇宙虚拟与现实的梦幻联动
STM32F103ZET6【标准库函数开发】----库函数介绍
Ajax cache prevention method
【精品】利用动态代理实现事务统一管理 二
测试你的机器学习流水线
洋桃电子STM32物联网入门30步笔记四、工程编译和下载
Navicat远程连接mysql
QT reading and writing XML files
excle加水印
Record: JS several methods to delete one or more items in the array
pgsql想实现mysql一样样的列子查询操作
【58】最后一个单词的长度【LeetCode】
Let the earth have less "carbon" and rest on the road
Add listening event to input element
洋桃电子STM32物联网入门30步笔记二、CubeIDE下载、安装、汉化、设置
LINQ学习系列-----1.4 匿名对象
RPC过程
JS中复制数组
Failed to convert a NumPy array to a Tensor(Unsupported Object type int)