Files
micropython-examples/pwm/led.py
2021-06-17 19:52:50 +12:00

16 lines
252 B
Python

from machine import Pin
from machine import PWM
from time import sleep
led = PWM(Pin(0, Pin.OUT))
for i in range(-1, 1024, 8):
led.duty(i)
print(i)
sleep(0.1)
for i in range(1023, -1, -8):
led.duty(i)
print(i)
sleep(0.1)