对上次通过学习让摄像头寻找色块,并亮对应的LED灯,这次进行了改进,采取舵机,通过不同色块让不同的舵机进行工作,从而进行一些动作
# Single Color RGB565 Blob Tracking Example
#
# This example shows off single color RGB565 tracking using the OpenMV Cam.
import sensor, image, time, math
from pyb import LED
red=LED(1)
green=LED(2)
#blue=LED(3)
s1=Servo(1)#p7
s2=Servo(2)#p8
threshold_index = 0 # 0 for red, 1 for green, 2 for blue
# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
# The below thresholds track in general red/green/blue things. You may wish to tune them...
thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds
(30, 100, -64, -8, -32, 32), # generic_green_thresholds
(0, 30, 0, 64, -128, 0)] # generic_blue_thresholds
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(