import rp2
from machine import Pin
@rp2.asm_pio(set_init=rp2.PIO.OUT_LOW)
def blink():
wrap_target()
set(pins, 1)
set(x, 31)
label("loop_on")
nop() [31]
jmp(x_dec,"loop_on")
set(pins, 0)
set(x,31)
label("loop_off")
nop() [31]
jmp(x_dec,"loop_off")
wrap()
# Instantiate a state machine with the blink program, at 2000Hz, with set bound to Pin(0)
sm0 = rp2.StateMachine(0, blink, freq=2000, set_base=Pin(0))
# Instantiate a state machine with the blink program, at 2000Hz, with set bound to Pin(25)
sm1 = rp2.StateMachine(1, blink, freq=2000, set_base=Pin(25))
# Activate the state machine 0 (external led)
sm0.active(1)
# Activate the state machine 1 (builtin led)
sm1.active(1)