Today we will program a 4 digits 7 segments as a counter from 0000 to 9999 by increasing every second. I will show you step by step to be clear.
STEP #1: Get to know 4 digits 7-segments
This 7-segments has 4 digits of the number, each could count from 0 to 9. The segments A-G are connected together for all of 4 digits. D1, D2, D3, and D4 are enable-pin for each digit.
STEP #2: Setup the circuit with the controller
Place the 7-segments on the board and connect pin one by one to the Arduino with the jump wire (You can use 220 Ohm resistors between Arduino's pins and 7-segment to protect the LEDs).
Now you need to connect correctly of each pin to run with the program:
2 - A
3 - B
4 - C
5 - C
6 - D
7 - E
8 - G
9 - D1
10 - D2
11 - D3
12 - D4
Recheck your connection and plug the Arduino USB to power up the controller.
STEP #3: Program the Arduino
I wrote this program base on loop to run the display. It may a bit difficult to understand, but you should try to understand it line by line to improve your program skill. This makes you a shortcode and fasts run on the controller. Here we go:
STEP #4: YEAH Let see
If there no display or you have problems with the number display, please check your connection circuit.
*Important: Check the type of your 7-segment to see it is Anode or Cathode.
*Try: if the LEDs display with random not a number, you can COMMENT the code line #33 and UNCOMMENT the conde line #34 and upload the code again to see if it is right back.
STEP #5: Please give me feedback or Suggestion
I share this from my experiece with this project. Please comment below to let me know it works or not with you. You can suggest my to do any project or other ways faster.