Published © GPL3+

LED Snake

A simple way to address 8 or more diodes using only 3 wires (ok, plus 5V and GND).

BeginnerShowcase (no instructions)30 minutes1,773
LED Snake

Things used in this project

Schematics

darlington_Dn5Coqfu8s.fzz

Code

Darlington.ino

Arduino
#define dataPin A0
#define latchPin A1
#define clockPin A2

void setup() {
	pinMode(latchPin, OUTPUT);

  pinMode(clockPin, OUTPUT);

  pinMode(dataPin, OUTPUT);
}
int patterns[15] = {B00000000,B00000001,B00000010,B00000101,B00001010,B00010101,B00101010,B01010101,B10101010,B01010100,B10101000,B01010000,B10100000,B01000000,B10000000};
void loop() {
	for(int i = 0; i < 256; i++) {

		digitalWrite(latchPin, LOW);

		shiftOut(dataPin, clockPin, MSBFIRST, patterns[i % 15]);

		digitalWrite(latchPin, HIGH);

		delay(125);
	}
}

Credits

Comments