light.py
# Questo lavoro è concesso in licenza MIT.
# Copyright (c) 2013-2026 OpenMV LLC. Tutti i diritti riservati.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Questo esempio mostra l'utilizzo dello shield luminoso con il Machine Module.
import time
from machine import PWM, Pin
# 50kHz pin6 timer2 channel1
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)