import array
import board
import rp2pio
import adafruit_pioasm
code = """
mov x, pins
in x, 32
push block
"""
assembled_code = adafruit_pioasm.assemble(code)
sm2 = rp2pio.StateMachine(
assembled_code,
frequency=2000,
in_pin_count = 8,
first_in_pin=board.GP0,
push_threshold=32,
auto_push=False,
)
while True:
buf = array.array('L', [0])
sm2.readinto(buf)
print(','.join(hex(x) for x in buf))