logo

摄像头串口发送数据能控制32的灯亮或灯灭,但是串口接收不到32发送的数据,确实发出去了

2018-12-13 18:22
Z
_6vdo
# UART Control
#
# This example shows how to use the serial port on your OpenMV Cam. Attach pin
# P4 to the serial input of a serial LCD screen to see "Hello World!" printed
# on the serial LCD display.

import time
from pyb import UART

# Always pass UART 3 for the UART number for your OpenMV Cam.
# The second argument is the UART baud rate. For a more advanced UART control
# example see the BLE-Shield driver.
uart = UART(3, 9600, timeout_char=1000)

while(True):
    if uart.any():
         tmp_data=uart.read()
       # tmp_data=int(tmp_data)
         print(tmp_data)

这个代码打印出接收到的数据,没错吧。

求助

2018-12-13 18:31
Z
_6vdo

这个是程序的原因还是串口出问题了?

2018-12-13 18:45
Z
_6vdo

还有问题是这个摄像头似乎不是上电就运行,直接连在一起,没有反应,我必须在电脑上按运行键吗?

2018-12-13 19:57
Z
_6vdo

@6vdo 这个知道了脱机运行