def knightRider(): for x in range(3): for led in ledList: latchPin.value = False simpleio.shift_out(dataPin, clock, led, msb_first=False) latchPin.value = True time.sleep(0.5)
""" import time import board import digitalio import simpleio # set up clock, data, and latch pins clk = digitalio.DigitalInOut(board.D12) data = digitalio.DigitalInOut(board.D11) latch = digitalio.DigitalInOut(board.D10) clk.direction = digitalio.Direction.OUTPUT latch.direction = digitalio.Direction.OUTPUT while True: data_to_send = 256 # shifting 256 bits out of data pin latch.value = False data.direction = digitalio.Direction.OUTPUT print('shifting out...') simpleio.shift_out(data, clk, data_to_send, msb_first=False) latch.value = True time.sleep(3) # shifting 256 bits into the data pin latch.value = False data.direction = digitalio.Direction.INPUT print('shifting in...') simpleio.shift_in(data, clk) time.sleep(3)
OE 13 Gnd MR 10 Vcc """ import time import board import digitalio import simpleio # set up clock, data, and latch pins data = digitalio.DigitalInOut(board.D9) data.direction = digitalio.Direction.OUTPUT latch = digitalio.DigitalInOut(board.D7) latch.direction = digitalio.Direction.OUTPUT clk = digitalio.DigitalInOut(board.D5) clk.direction = digitalio.Direction.OUTPUT ff = 0 # flip flop while True: ff = 1 - ff if (ff == 1): byte = 255 else: byte = 0 # write to 595 chip latch.value = False simpleio.shift_out(data, clk, byte) print("sending: {0:#010b} {0}".format(byte), end="\n") latch.value = True time.sleep(0.25)
def quick(): for led in ledList: latchPin.value = False simpleio.shift_out(dataPin, clock, led, msb_first=False) latchPin.value = True time.sleep(0.05)