In this post, you’ll see how it’s so easy to drive a seven segment display with an Arduino board.
The seven segment display is simply a group of seven LEDs connected together and placed inside a nice enclosure to give the shape of a number when those LEDs are illuminated with a certain combination.
Components you need
7 segment display
Arduino UNO or Arduino Mega or Arduino Micro
Some wires
Circuit
Code
void setup()
{
// define pin modes
pinMode(
2,OUTPUT);
pinMode(
3,OUTPUT);
pinMode(
4,OUTPUT);
pinMode(
5,OUTPUT);
pinMode(
6,OUTPUT);
pinMode(
7,OUTPUT);
pinMode(
8,OUTPUT);
}
void loop()
{
// loop to turn leds od seven seg ON
for(
inti=
2;i<
9;i++)
{
digitalWrite(i,HIGH);
delay(
600);
}
// loop to turn leds od seven seg OFF
for(
inti=
2;i<
9;i++)
{
digitalWrite(i,LOW);
delay(
600);
}
delay(
1000);
}
This shows how it’s so easy to interface a seven segment display to the Arduino board.
Source:
https://www.allaboutcircuits.com/projects/interface-a-seven-segment-display-to-an-arduino/