Add pwm examples

This commit is contained in:
2021-06-17 19:52:50 +12:00
parent de247b3354
commit d803fd81a5
2 changed files with 32 additions and 0 deletions

15
pwm/led.py Normal file
View File

@@ -0,0 +1,15 @@
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)