# Example of using PIO writing a parallel byte from data - bit.0 to bit.7
# for a more wrapped-up examples, see https://github.com/raspberrypi/pico-micropython-examples/blob/master/pio/pio_pwm.py
# https://github.com/LifeWithDavid/Raspberry-Pi-Pico-PIO/blob/main/PIO%20Parallel%20Port
# Works !
from machine import Pin
from rp2 import PIO, StateMachine, asm_pio
from time import sleep
@asm_pio(out_init=(rp2.PIO.OUT_HIGH,) * 8, out_shiftdir=PIO.SHIFT_RIGHT,
autopull=True, pull_thresh=16)
def paral_prog():
pull()
out(pins, 8) # change for # of bits required.
paral_sm = StateMachine(0, paral_prog, freq=10000000, out_base=Pin(0))
paral_sm.active(1)
x = 0
while True:
for i in range(500):
paral_sm.put(i)
# print(paral_sm)
# sleep(0.01 )
# x += 1
# print(x)