from machine import Pin, PWM
from utime import sleep_ms
# Initialize PWM on pins 5, 9, and 1 for the LEDs
l1 = PWM(Pin(5))
l2 = PWM(Pin(9))
l3 = PWM(Pin(1))
# Set the PWM frequency to 1000 Hz for all LEDs
l1.freq(1000)
l2.freq(1000)
l3.freq(1000)
# Gradually increase the brightness from 0 to 65535 in steps of 100
for br in range(0, 65535, 100):
l1.duty_u16(br)
sleep_ms(10)
l2.duty_u16(br)
sleep_ms(10)
l3.duty_u16(br)
sleep_ms(10)
# After the loop, turn off all LEDs by setting their brightness to 0
l1.duty_u16(0)
l2.duty_u16(0)
l3.duty_u16(0)