那我的为什么亮不了,是要在那个页面编辑才行吗
F
fopl
@fopl
0
声望
6
楼层
496
资料浏览
0
粉丝
0
关注
fopl 发布的帖子
-
RE: 在判断颜色以后亮红灯
@kidswong999 # Untitled - By: Administrator - 周三 7月 8 2020
import sensor, image, time,pyb
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot()
print(clock.fps())
import sensor, image, timesensor.reset() # 初始化摄像头 sensor.set_pixformat(sensor.RGB565) # 格式为 RGB565. sensor.set_framesize(sensor.QVGA) sensor.skip_frames(10) # 跳过10帧,使新设置生效 sensor.set_auto_whitebal(False) # Create a clock object to track the FPS. ROI=(228,55,15,15) while(True): img = sensor.snapshot() # Take a picture and return the image. statistics=img.get_statistics(roi=ROI) color_l=statistics.l_mode() color_a=statistics.a_mode() color_b=statistics.b_mode() print(color_l,color_a,color_b) img.draw_rectangle(ROI) if color_l>50: redled.on() else: ledled.off() 灯不会亮,是还要怎么调用吗
-
在判断颜色以后亮红灯
import sensor, image, time sensor.reset() # 初始化摄像头 sensor.set_pixformat(sensor.RGB565) # 格式为 RGB565. sensor.set_framesize(sensor.QVGA) sensor.skip_frames(10) # 跳过10帧,使新设置生效 sensor.set_auto_whitebal(False) # Create a clock object to track the FPS. ROI=(80,30,15,15) while(True): img = sensor.snapshot() # Take a picture and return the image. statistics=img.get_statistics(roi=ROI) color_l=statistics.l_mode() color_a=statistics.a_mode() color_b=statistics.b_mode() print(color_l,color_a,color_b) img.draw_rectangle(ROI) red_led = pyb.LED(1) while(color_l>50): red_led.on() while(color_l<=50): red_led.off()
这样写好像红灯不会亮,应该怎么写才能使用 color_l大于50的时候亮红灯