串口通信
-
我想将openmv的数据传输到串口助手上,参照教程,发送 hello world串口助手可以收到,但发送复杂的数据就都没有反应,这是为什么?
-
需要贴出来代码,才能知道
-
# Blob Detection and uart transport import sensor, image, time from pyb import UART import json # For color tracking to work really well you should ideally be in a very, very, # very, controlled enviroment where the lighting is constant... yellow_threshold = (65, 100, -10, 6, 24, 51) # You may need to tweak the above settings for tracking green things... # Select an area in the Framebuffer to copy the color settings. 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, 115200) while(True): img = sensor.snapshot() # Take a picture and return the image. blobs = img.find_blobs([yellow_threshold]) if blobs: print('sum :', len(blobs)) output_str = json.dumps(blobs) for b in blobs: # Draw a rect around the blob. img.draw_rectangle(b.rect()) # rect img.draw_cross(b.cx(), b.cy()) # cx, cy print('you send:',output_str) uart.write(output_str+'\n') else: print('not found!')
这个代码不能够显示
-
烧进去之后,摄像头就不往回传数了
-
看一下终端,是不是显示not found!