nrf5/modules: Updating pulse example to work with Pin object instead of hard coded pin number.
This commit is contained in:
parent
d759123886
commit
c1c78404b6
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user