from machine import Pin, PWM
from time import sleep
# Wait for USB to become ready
sleep(0.1)
# Setup PWM on GP15
led = PWM(Pin(15))
led.freq(1000) # 1 kHz PWM frequency (good for LEDs)
#-----------------main--------------------
while True:
# Fade IN (0 -> 100%)
for duty in range(0, 65536, 1000):
led.duty_u16(duty)
sleep(0.05)
# Fade OUT (100% -> 0)
for duty in range(65535, -1, -1000):
led.duty_u16(duty)
sleep(0.05)
Loading
pi-pico-w
pi-pico-w