light.py
# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2026 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# 此示例展示了如何配合Machine模块使用补光扩展板。
import time
from machine import PWM, Pin
# 50kHz pin6 timer2 channel1(50千赫兹 引脚6 定时器2 通道1)
pwm = PWM(Pin("P6"), freq=50000, duty_u16=0)
while True:
for i in range(101):
pwm.duty_u16((i * 65535) // 100)
time.sleep_ms(10)
for i in range(101):
pwm.duty_u16(((100 - i) * 65535) // 100)
time.sleep_ms(10)