7 Segment LED with Shift Register

COURSE FEATURES

  • Duration 22:34
  • Hardware Wire
  • Hardware 7 Segment LED
  • Hardware 595 Shift register

ABOUT THE COURSE

As I mentioned in 102, we need to use less than 7 wires to connect a 7 segment LED. In this video, we will make it work with 3 wires.

What You Will Learn

In this tutorial, we will hook up a 7 segment LED to a shift register and make it count.

The seven segment LED is used on the betting stations. If you only allow up to 9 bets, you will use 10 on each board. If you do as the real machine and allow up to 20 bets, you will need 20 on each betting station.

Video #3

int datapin = 13;
int latchpin = 12;
int clockpin = 11;

byte number[] = { 0b11111100, 0b01100000, 0b10110110, 0b11100110, 0b01101010, 0b11001110 };

void setup()
{
	pinMode(datapin, OUTPUT);
	pinMode(latchpin, OUTPUT);
	pinMode(clockpin, OUTPUT);
}

void loop()
{
	digitalWrite(latchpin, LOW);
	shiftOut(datapin, clockpin, MSBFIRST, number[0]);
	digitalWrite(latchpin, HIGH);
	
	delay(1000);
	
	count++;
	
	if (count > 5)
	{
		count = 0;
	}

}


Review

We hooked up a shift register to a 7 segment LED to decrease the number of digital pins used.