logo

测试openmv 与 arduino 第一次 通信成功 里的代码有几处出错,不明白为什么

2018-10-15 14:48
U
_4l1e

import sensor, image, time

import json

from pyb import UART

sensor.reset() # Initialize the camera sensor.

sensor.set_pixformat(sensor.RGB565) # use RGB565.

sensor.set_framesize(sensor.QQVGA) # use QQVGA for speed.

sensor.skip_frames(10) # Let new settings take affect.

sensor.set_auto_whitebal(False) # turn this off.

clock = time.clock() # Tracks FPS.

uart = UART(3, 9600)

while(True):

clock.tick() # Track elapsed milliseconds between snapshots().

img = sensor.snapshot() # Take a picture and return the image.

img.lens_corr(1.5)

for code in img.find_qrcodes():

message = code.payload()

uart.write(message)

print(code)

else:

print(“not found!”)

I
网红小智智 星瞳科技

起码你要说一下什么目的,什么错误吧……

2018-10-15 15:11
U
_4l1e

我想通过openmv把如果检测到前面是 红灯 就给arduino串口发个信息,在电脑前研究了很长时间,都不行

I
网红小智智 星瞳科技

可以你的代码,和你的目标,一点关系都没有......