from time import sleep
from machine import Pin, PWM
sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
# full brightness LED - no PWM control
ledBright = Pin(0, Pin.OUT)
ledBright.toggle()
# dimmable LED - with PWM control
ledDimmable = PWM(Pin(3))
ledDimmable.freq(50)
while True:
for duty in range(0, 65536, 256): # Fade in
ledDimmable.duty_u16(duty)
sleep(0.02)
for duty in range(65535, -1, -256): # Fade out
ledDimmable.duty_u16(duty)
sleep(0.02)