接收不到数据是为什么?
-
为什么在识别圆形的程序后面加上一个串口接收数据的程序,我向openmv发送了66,77这两个数据,符合if中的条件判断,但串口调试助手上收不到我想要openmv发送的这个数据2呢?是程序有问题吗?
import sensor, image, time from pyb import UART sensor.reset() sensor.set_pixformat(sensor.RGB565) # grayscale is faster sensor.set_framesize(sensor.QQVGA) sensor.skip_frames(time = 2000) clock = time.clock() while(True): clock.tick() img = sensor.snapshot().lens_corr(1.8) for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2): img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0)) uart = UART(3, 115200) if uart.any(): a = uart.read().decode().split(',') x = int(a[0]) y = int(a[1]) if 50<x<100&50<y<100: t = 2 output_str="[%d]" % (t) uart.write(output_str+'\r\n')
-
先使用标准代码测试发送数据。
https://singtown.com/learn/50235/