This repository contains code and wiring information to display numbers 0 to 3 on a Common Anode 7-segment LED display using an Arduino.
The display's segments (A-G) are connected to digital pins 2-8 on the Arduino, while the display's common anode is connected to digital pins 9-12.
pinA
(2) - Segment ApinB
(3) - Segment BpinC
(4) - Segment CpinD
(5) - Segment DpinE
(6) - Segment EpinF
(7) - Segment FpinG
(8) - Segment GD1
(9) - Common Anode Digit 1D2
(10) - Common Anode Digit 2D3
(11) - Common Anode Digit 3D4
(12) - Common Anode Digit 4
The setup()
function initializes the digital pins as outputs.
The loop()
function sequentially displays numbers 0-3:
0
: All segments except G are turned on.1
: Segments B and C are turned on.2
: Segments A, B, D, E, and G are turned on.3
: Segments A, B, C, D, and G are turned on.
Each digit is displayed for a brief duration of 1 millisecond, creating the appearance of sequential number display with a one-second interval.
Feel free to modify the code to display more numbers or alter the display timing as needed.
Ensure correct connections and use appropriate resistors for the LED segments to prevent damage to the components.
For further details, refer to the code comments and the provided wiring image.