nrf5/modules: Updating pulse example to work with Pin object instead of hard coded pin number.

This commit is contained in:
Glenn Ruben Bakke 2016-12-24 01:16:23 +01:00
parent d759123886
commit c1c78404b6

View File

@ -1,10 +1,10 @@
import time
from machine import PWM
from machine import PWM, Pin
def pulse():
for i in range(0, 101):
p = PWM(0, pin=17, freq=PWM.FREQ_16MHZ, duty=i, period=16000)
p = PWM(0, Pin("A17"), freq=PWM.FREQ_16MHZ, duty=i, period=16000)
time.sleep_ms(10)
for i in range(0, 101):
p = PWM(0, pin=17, freq=PWM.FREQ_16MHZ, duty=100-i, period=16000)
p = PWM(0, Pin("A17"), freq=PWM.FREQ_16MHZ, duty=100-i, period=16000)
time.sleep_ms(10)