Controlling a Seven-Segment Display Using Arduino Part 1
A seven segment display is composed of seven elements that individually on or off can be combined to produce simplified representations of the numbers 0-9.
There are two types of 7-segment displays:
- Common Anode with all the LED anodes connected together. These need a display driver with outputs which become low to light each segment. The common anode is connected to +Vs.
- Common Cathode with all the LED cathodes connected together. These need a display driver with outputs which become high to light each segment. The common cathode is connected to 0V.
The segments in a 7-segment display are referred to by the letters A-G, as shown in the picture. Some displays have a dot to allow for the representation of a decimal point.
You might also enjoy:
- Arduino 2-Digit 7-Segment Display Counter: Circuit
- Controlling a Seven-Segment Display Using Arduino Part 2
- Controlling a Seven-Segment Display Using Arduino Part 4
- Controlling a Seven-Segment Display Using Arduino Part 3










[...] Function lightSegments was reused from the single-digit 7-segment sketch: [...]
[...] we were using a single-digit display, we connected the common anode pin to our Vdd supply, but with two digits we have to drive them [...]
[...] Moving on to something a little more challenging, I wanted to make the display show numbers, perhaps as a basic counter. That lead me to a tutorial from Hacktronics. I felt that the article was helpful, but I was left to my own devices to write the code other than a big hint as to how to get Arduino to display numbers. Some trial & error came in to play here as I discovered that the documentation for my displays, aside from being hard to read, was completely incorrect with the pinout data. Also, I realized the difference between a LEDs with a common cathode vs. a common anode: the digitalWrite values (HIGH & LOW) are opposite for which ones you are using. With my common cathode LEDs, on is HIGH & off is LOW. (Also, here is an explanation of the difference between a common anode vs. common cathode.) [...]