This tutorial uses Pico, and K210 requires running the program in K210-AI (stm32_pico_arduino) to start the experiment Pico * 1 K210 perspective module * 1 (requires SD card (with AI model inside) and camera) USB to TTL module * 1
pico | USB to TTL module |
---|---|
GP8 | RXD |
GND | GND |
pico | k210 |
---|---|
GP9 | TXD |
GND | GND |
VCC | 5V |
Wiring as shown in the diagram: |
xu1 = UART(1, baudrate=115200, tx=Pin(8), rx=Pin(9), bits=8, parity=None, stop=0)
k210_data_class = 0
k210_data_x = 0
k210_data_y = 0
k210_data_w = 0
k210_data_h = 0
k210_data_id = 0
k210_data_msg = ""
while True:
while u1.any() >0:
rxx=u1.read()
recv_k210_data(rxx)
if k210_data_class != 0:
if k210_data_class == 1:
sstr = "x="+str(k210_data_x) +" y="+str(k210_data_y) +" w="+str(k210_data_w) +" h="+str(k210_data_h) +"\r\n"
u1.write(sstr)
#u1.write(k210_data_msg+'\r\n')
k210_data_class = 0
Obtained from the program
This processing mainly involves receiving a message from k210 and calling recv_ K210_ Data() for processing and assigning the processed information to k210_ Data_ Members of XXX. Attention If you want to develop for the second time, without changing the K210 program and data processing functions, directly call K210_ Data_ The variable of XXX is good (xxx: refers to x y w h id msg)