CircuitPython driver for 74HC595 shift register.

  • Author(s): Kattni Rembor, Tony DiCola

Implementation Notes


“* 74HC595 Shift Register - 3 pack

Software and Dependencies:

class adafruit_74hc595.DigitalInOut(pin_number: Pin, shift_register_74hc595: ShiftRegister74HC595)

Digital input/output of the 74HC595. The interface is exactly the same as the digitalio.DigitalInOut class, however note that by design this device is OUTPUT ONLY! Attempting to read inputs or set direction as input will raise an exception.

property direction

Direction can only be set to OUTPUT.

property pull

Pull-up/down not supported, return None for no pull-up/down.


switch_to_input is not supported.

switch_to_output(value: bool = False, **kwargs)

DigitalInOut switch_to_output

property value

The value of the pin, either True for high or False for low.

class adafruit_74hc595.ShiftRegister74HC595(spi: SPI, latch: DigitalInOut, number_of_shift_registers: int = 1, baudrate: int = 1000000)

Initialise the 74HC595 on specified SPI bus, indicate the number of shift registers being used and optional baudrate.

get_pin(pin: int) Pin

Convenience function to create an instance of the DigitalInOut class pointing at the specified pin of this 74HC595 device .

property gpio

The raw GPIO output register. Each bit represents the output value of the associated pin (0 = low, 1 = high).

property number_of_shift_registers

The number of shift register chips