# Fade LEDs on and off from time import sleep_ms from machine import Pin, PWM LED = Pin(17, Pin.OUT) LED = PWM(Pin(17)) LED.freq(100) x = 0 dx = 100 while(1): x += dx LED.duty_u16(x) if(x > 65000): dx = -abs(dx) if(x <= 0) dx = abs(dx) sleep_ms(1)