Things used in this project


Night Rider CodeC/C++
Using three 74HC595s to control 24 leds (outputs) on the arduino uno. 
This is an improved version by John Rogers

int latchPin = 5;   // to pin 12
int clockPin = 6;	// to pin 11
int dataPin = 4;	// to pin 14

int numLights=24;
unsigned long light = 0;  // Bit pattern for entire display
byte b1 = 0;				// byte place holders for each shift register
byte b2 = 0;				// extracted from "light"
byte b3 = 0;


void setup() 
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
 // Serial.begin(9600);

void loop() 
	for (int i = 0; i < numLights*2; i++)
		int shift = i;
		if( i >= numLights )	//if i is above numlights then wee need to start
		{						// moving back to the left.
			shift = numLights*2 - i - 1;
		// Extract the bytes of the light patter to be sent out
		light = (long)(1)<<shift;
		b1 = (byte)((light>>16)&0xFF);
		b2 = (byte)((light>>8)&0xFF);
		b3 = (byte)((light)&0xFF);
		updateShiftRegister();	// shift out b1, b2 and b3

void updateShiftRegister()
   	digitalWrite(latchPin, LOW);
   	shiftOut(dataPin, clockPin, MSBFIRST, b1);
   	shiftOut(dataPin, clockPin, MSBFIRST, b2);
   	shiftOut(dataPin, clockPin, MSBFIRST, b3);
   	digitalWrite(latchPin, HIGH);


David A Riewe

Engineering Tech who enjoys hacking electronics, learning about new devices and programming. Founder of HackerSpaceTech



Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback


Similar projects you might like

Using CA and CC RGB LED by Current Sourcing and Sinking!
  • 525
  • 48


RGB LEDs are of two types, common cathode and common anode which behave differently with same Arduino code; how to resolve this.

Arduino Amiga Floppy Disk Reader
  • 4,981
  • 8

Work in progress

An Arduino powered floppy disk controller and reader for making disk images from old AmigaDOS floppy disks.

Simple Dark Sensor
  • 93
  • 2

A simple dark sensor with or without Arduino.

Quadrature Encoder Demo
  • 512
  • 4

Full instructions

Use a 3D printed encoder wheel, LED, and 2 photocells to demonstrate how a quadrature encoder works.

How to use the accelerometer- gyroscope GY-521
  • 250
  • 2

Full instructions

Find out how the world turns. Read the values of the accelerometer and the gyroscope.

Simple RGB LED Light with Fade
  • 38
  • 1

A Simple RGB LED light on Arduino UNO with Fade.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login