# Example of using PIO writing a parallel byte from data
# for a more wrapped-up examples, see https://github.com/raspberrypi/pico-micropython-examples/blob/master/pio/pio_pwm.py
from machine import Pin
from rp2 import PIO, StateMachine, asm_pio
from time import sleep
@asm_pio(out_init=(rp2.PIO.OUT_LOW,) * 8, out_shiftdir=PIO.SHIFT_RIGHT,
autopull=False, pull_thresh=8, push_thresh=8)
def paral_prog():
label("bitloop")
#pull()
in_(pins,8)
mov(osr, isr)
out(pins, 8)
jmp("bitloop")
paral_sm = StateMachine(
0,
paral_prog,
freq=10000000,
in_base=Pin(1, Pin.OUT, Pin.PULL_UP),
out_base=Pin(15)
)
Pin(3, Pin.IN, Pin.PULL_UP)
while True:
for i in range(1000):
# paral_sm.put(i)
# print(i)
sleep(0.1 )