Arduino library for controlling HC595 shift registers with support for cascading multiple chips.
- Template-based design for any number of cascaded chips
- Simple and intuitive API
- Efficient buffer management
- Zero runtime overhead
- Download from Releases
- Sketch → Include Library → Add .ZIP Library
- Select the downloaded file
lib_deps = https://github.com/Studentul404/CustomHC595.git#include <CustomHC595.h>
// Single chip (8 outputs)
CustomHC595<1> sr(8, 11, 12); // latchPin, dataPin, clockPin
void setup() {
sr.write(0, HIGH); // Turn on output 0
}
void loop() {
sr.write(0, LOW);
delay(500);
sr.write(0, HIGH);
delay(500);
}// 4 chips = 32 outputs
CustomHC595<4> sr(8, 11, 12);
void loop() {
// Control any output from 0 to 31
sr.write(15, HIGH);
sr.write(31, LOW);
}| Method | Description |
|---|---|
begin(latch, data, clock) |
Initialize pins |
write(num, state) |
Set output state (0 to N*8-1) |
setAll() |
Turn on all outputs |
clearAll() |
Turn off all outputs |
update() |
Manually refresh outputs |
amount() |
Get total number of outputs |
Arduino → HC595
Pin 8 → ST_CP (Latch)
Pin 11 → DS (Data)
Pin 12 → SH_CP (Clock)
5V → VCC
GND → GND
Cascading: Connect Q7' of first chip to DS of next chip. All chips share latch, clock, VCC, and GND.
Stability tip: For reliable operation with multiple chips or long wires, add 0.1µF capacitor between VCC and GND of each chip.
Check examples/ folder for:
BasicUsage- Single chip demoMultipleChips- Cascaded chips demo
MIT License - see LICENSE file