from machine import Pin
from utime import sleep
sleep(0.1) # Wait for USB to become ready
print("Running")
#set up the shift register Pins
# 74HC595 serial in, Paralell out with latch
dataPin=Pin(13, Pin.OUT) #pink
latchPin=Pin(15, Pin.OUT) #yellow wire
clockPin=Pin(14, Pin.OUT) #blue wire
def shift_update(inputData,data,clock,latch):
#put latch down to start data sending
latch.value(0) #take latch off
#load data in reverse order dp,gfedcba
for i in range(7, -1, -1):
clock.value(0) #set clock low to write data
data.value(int(inputData[i]))
clock.value(1)
latch.value(1) #so the led's remain on
numbers = [
"11111111", #0
"10011111", # this is in order abcdefg and dp
"00100101",
"00001101",
"10011001",
"01001001",
"01000001",
"00011111",
"00000001",
"00011001" #9
]
while True:
for number in numbers:
shift_update(number,dataPin,clockPin,latchPin)
sleep(0.5)