Extract of longer program. Just to toggle the .side pin and then quit the PIO program. Causes loop and have to nuke the PICO! Loops before the 'Run' print. Thanks
TypeError: function takes 2 positional arguments but 1 were given
from machine import Pin, PWM
from time import sleep, sleep_ms, time_ns
import rp2
def main():
sm = rp2.StateMachine(0, test, freq=180000, sideset_base=Pin(8
sm.irq(irqHandler)
sm.active(1)
print('Run')
sleep(5)
print('Slept')
def irqHandler(self, sm):
print('IRQ servo')
@rp2.asm_pio(sideset_init=rp2.PIO.OUT_LOW)
def test():
mov(x,x) .side(1)
mov(x,x) .side(0)
irq(block, 0)
printis re-entrant on a PICO? You have to be very careful what you do inside an ISR because you have no way of knowing what the processor was in the middle of doing. Why not toggle an LED on/off in the ISR to show that it is being reached?