logo

openmv和树莓派通过杜邦线连接起来之后,树莓派接收的数据显示b'\x00\x00\x00@\x00\x00'

2023-03-30 15:34
U
xumt

树莓派端的代码:

import serial
import time
ser = serial.Serial('/dev/ttyAMA0', 9600)
if ser.isOpen == False:
    ser.open()
try:
    while True:
  
        size = ser.inWaiting()
        if size != 0:
          
            response = ser.read(size)
            print(response)
           
            ser.flushInput()
           
            time.sleep(0.1)
except KeyboardInterrupt:
    ser.close()

openmv

ed3b94ce-a22e-406c-9245-a69b172bacaf.png
import time
from pyb import UART

uart = UART(3, 9600)
num = 0
while(True):
    uart.write("Hello world\r")
    time.sleep_ms(1000)

在树莓派上运行代码显示如下:

33cfead3-ea44-488e-bcd3-1f693eb067af.png
U
xumt

之前有成功接收过,但不知道为什么现在变成这样了

2023-03-30 16:59
I
网红小智智 星瞳科技

第一步:在电脑上,不连接OpenMV,用USB转串口,看一下树莓派的串口是不是正常的。

第二步:再电脑上,不使用树莓派,用USB转串口,看一下OpenMV的输出是不是正常的。