openmv/scripts/examples/50-OpenMV-Boards/50-Light-Shield/light.py
2023-10-29 22:41:04 -07:00

14 lines
388 B
Python

# This work is licensed under the MIT license.
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
import time
from pyb import Pin, Timer
# 50kHz pin6 timer2 channel1
light = Timer(2, freq=50000).channel(1, Timer.PWM, pin=Pin("P6"))
light.pulse_width_percent(100) # adjust light 0~100
while True:
time.sleep_ms(1000)