Rename folders as per suggestion from Rajat
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""Send this code, run and watch the repl.
|
||||
Then turn the wheel slowly to see the change"""
|
||||
import time
|
||||
import board
|
||||
import rp2pio
|
||||
import adafruit_pioasm
|
||||
import array
|
||||
|
||||
pio_input = """
|
||||
.program pio_input
|
||||
in pins, 1 ; read in pin (into ISR)
|
||||
push noblock ; put this into input FIFO
|
||||
"""
|
||||
|
||||
assembled = adafruit_pioasm.assemble(pio_input)
|
||||
|
||||
sm = rp2pio.StateMachine(assembled, frequency=2000, first_in_pin=board.GP20)
|
||||
|
||||
buffer = array.array("I", [0])
|
||||
|
||||
while True:
|
||||
# read data from the fifo
|
||||
sm.readinto(buffer)
|
||||
# print it.
|
||||
print(f"{buffer[0]:032b}")
|
||||
time.sleep(0.1)
|
||||
@@ -0,0 +1,27 @@
|
||||
"""Send this code, run and watch the repl.
|
||||
Then turn the wheel slowly to see the change"""
|
||||
import board
|
||||
import rp2pio
|
||||
import adafruit_pioasm
|
||||
import array
|
||||
|
||||
pio_input = """
|
||||
.program pio_input
|
||||
in pins, 2 ; read in two pins (into ISR)
|
||||
push noblock ; put ISR into input FIFO
|
||||
"""
|
||||
|
||||
assembled = adafruit_pioasm.assemble(pio_input)
|
||||
|
||||
## set up a statemachine
|
||||
sm = rp2pio.StateMachine(
|
||||
assembled, frequency=2000, first_in_pin=board.GP20, in_pin_count=2
|
||||
)
|
||||
|
||||
buffer = bytearray(1) # an array of bytes to read into - we are just asking for a byte
|
||||
|
||||
while True:
|
||||
# read data from the fifo
|
||||
sm.readinto(buffer)
|
||||
# print it.
|
||||
print("{:08b}".format(buffer[0]))
|
||||
Reference in New Issue
Block a user