HeathenHacks
Published © LGPL

3 Pins, 32 LEDs, 4 Shift Registers [74HC595]

An arduiNOOB friendly tutorial for beginners on daisy-chaining.

BeginnerFull instructions provided25,022
3 Pins, 32 LEDs, 4 Shift Registers [74HC595]

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Shift Register- Serial to Parallel
Texas Instruments Shift Register- Serial to Parallel
74HC595
×4
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
LED (generic)
LED (generic)
Depends on your preference.
×1
Resistor 100 ohm
Resistor 100 ohm
Depends on the LEDs.
×1
Jumper wires (generic)
Jumper wires (generic)
A lot.
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Daisy-chained. Schematic.

Code

Edited Sample Code From The HC595 Library.

Arduino
#include <HC595.h>

const int chipCount = 2;  // Number of serialy connected 74HC595 (8 maximum)
const int latchPin = 4;  // Pin ST_CP (12) of the 74HC595
const int clockPin = 3;  // Pin SH_CP (11) of the 74HC595
const int dataPin = 2;   // Pin DS (14) of the 74HC595

//Constructor
HC595 ledArray(chipCount,latchPin,clockPin,dataPin);

int delayMs = 30;
int lastPin = ledArray.lastPin();

void setup() {
  ledArray.reset();
}

void loop() {
  for (int i = 0 ; i <= lastPin ; i++) {
    ledArray.setPin(i, ON);
    delay(delayMs);
  }
  for (int i = lastPin ; i >= 0 ; i--) {
    ledArray.setPin(i, OFF);
    delay(delayMs);
  }
  for (int i = lastPin ; i >= 0 ; i--) {
    ledArray.setPin(i, TOGGLE);
    delay(delayMs);
  }
  for (int i = 0 ; i <= lastPin ; i++) {
    ledArray.setPin(i, TOGGLE);
    delay(delayMs);
  }
}

HC595 Library by Mr. J. Bellavance

Credits

HeathenHacks

HeathenHacks

24 projects • 57 followers
I don't know what I'm doing here.

Comments