Example: 50-OpenMV-Boards/60-Shields/68-Light-Shield/light.py
# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
import time
from pyb import Pin, Timer
# 50kHz pin6 timer2 channel1(50千赫兹 引脚6 定时器2 通道1)
light = Timer(2, freq=50000).channel(1, Timer.PWM, pin=Pin("P6"))
light.pulse_width_percent(100) # 亮度调节0~100
while True:
time.sleep_ms(1000)