commit
93b03d8b3a
|
@ -1,7 +1,7 @@
|
|||
import time, _thread, machine
|
||||
|
||||
def task(n, delay):
|
||||
led = machine.Pin(25, machine.Pin.OUT)
|
||||
led = machine.Pin("LED", machine.Pin.OUT)
|
||||
for i in range(n):
|
||||
led.high()
|
||||
time.sleep(delay)
|
||||
|
|
|
@ -19,7 +19,7 @@ def blink():
|
|||
nop() [31]
|
||||
wrap()
|
||||
|
||||
# Instantiate a state machine with the blink program, at 2000Hz, with set bound to Pin(25) (LED on the rp2 board)
|
||||
# Instantiate a state machine with the blink program, at 2000Hz, with set bound to Pin(25) (LED on the Pico board)
|
||||
sm = rp2.StateMachine(0, blink, freq=2000, set_base=Pin(25))
|
||||
|
||||
# Run the state machine for 3 seconds. The LED should blink.
|
||||
|
|
|
@ -14,7 +14,7 @@ def prog():
|
|||
pass
|
||||
|
||||
|
||||
# Construct the StateMachine, binding Pin(25) to the set pin.
|
||||
# Construct the StateMachine, binding Pin 25 to the set pin.
|
||||
sm = rp2.StateMachine(0, prog, set_base=Pin(25))
|
||||
|
||||
# Turn on the set pin via an exec instruction.
|
||||
|
|
|
@ -34,7 +34,7 @@ class PIOPWM:
|
|||
self._sm.put(value)
|
||||
|
||||
|
||||
# Pin 25 is LED on Pico boards
|
||||
# Pin 25 on Pico boards
|
||||
pwm = PIOPWM(0, 25, max_count=(1 << 16) - 1, count_freq=10_000_000)
|
||||
|
||||
while True:
|
||||
|
|
|
@ -5,7 +5,7 @@ from machine import Pin, PWM
|
|||
|
||||
|
||||
# Construct PWM object, with LED on Pin(25).
|
||||
pwm = PWM(Pin(25))
|
||||
pwm = PWM(Pin("LED"))
|
||||
|
||||
# Set the PWM frequency.
|
||||
pwm.freq(1000)
|
||||
|
|
Ładowanie…
Reference in New Issue