导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. 2s4v
    2
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    2s4v

    @2s4v

    0
    声望
    1
    楼层
    208
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    2s4v 关注

    2s4v 发布的帖子

    • 为什么这段代码脱机运行后补光灯不亮,去掉除了补光灯外的代码后又能亮
      请在这里粘贴代码import sensor
      import time
      import display
      from pyb import UART, LED
      from pyb import Pin, Timer
      sensor.reset()
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.LCD) #128x160
      sensor.skip_frames(time=2000)
      clock = time.clock()
      lcd = display.SPIDisplay()
      black = (32, 100, -128, 127, -128, 127)
      uart = UART(3, 9600)
      # 初始化定时器  
      timer = Timer(2, freq=50000)  
      light = timer.channel(1, Timer.PWM, pin=Pin("P6"))  
      light.pulse_width_percent(100)  # 初始设置为100%占空比  
      # led_blue = LED(3)
      # led_blue.on()
      # 50kHz pin6 timer2 channel1
      while True:
      	time.sleep(1000)
      	img = sensor.snapshot()
      	blobs = img.find_blobs([black], invert=True, roi=[0, 60, 128, 30])
      	if len(blobs) == 1:
      		# led_blue.on()
      		img.draw_rectangle([0, 60, 128, 30])
      		img.draw_rectangle(blobs[0][0:4], color=(255,0, 0))
      		lcd.write(img)
      		uart.write('#' + str(blobs[0].cx()) + '$')
      		print('#' + str(blobs[0].cx()) + '$')
      	elif len(blobs) == 0:
      		uart.write('S')
      		print('S')
      
      发布在 OpenMV Cam
      2
      2s4v