当前位置:网站首页>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
边栏推荐
- Flink SQL实现流批一体
- 虚拟线上展会-线上vr展馆实现24h沉浸式看展
- pdf加水印
- What is RPC
- Let the earth have less "carbon" and rest on the road
- pgsql想实现mysql一样样的列子查询操作
- synchronized 锁的基本用法
- QFileDialog select multiple files or folders
- Queue (C language / linked list)
- PgSQL wants to implement all kinds of column sub query operations of MySQL
猜你喜欢
随机推荐
Flash project cross domain interception and DBM database learning [Baotou cultural and creative website development]
vmware 搭建ES8的常见错误
IDEA导入commons-logging-1.2.jar包
Get the absolute path of the class according to the bytecode
Queue (C language / linked list)
洋桃电子STM32物联网入门30步笔记一、HAL库和标准库的区别
Protobuf简介
Yangtao electronic STM32 Internet of things entry 30 step notes II. Cube ide download, installation, sinicization and setting
Introduction to protobuf
pgsql想实现mysql一样样的列子查询操作
Consensus Token:web3.0生态流量的超级入口
Knowledge points and problem solutions related to information collection
Type anonyme (Principes fondamentaux du Guide c)
请问中衍期货安全靠谱吗?
GUI编程简介 swing
Stm32f103zet6 [development of standard library functions] - Introduction to library functions
DOM 学习之—添加+-按钮
Harbor企业级镜像管理系统实战
扣缴义务人
Detailed description of self feeling of auricular point weight loss 0422