4-Digit Seven-Segment Display
The 4-digit seven-segment display consists of 12 pins. Among these pins, 8 are assigned to the 8 LEDs present in each seven-segment display, which are responsible for segments A to G and the decimal point (DP). The remaining 4 pins represent the 4 digits from D1 to D4.
Each of the four digits present in the module has a common connection point. The same segment numbers in each digit are concatenated together, allowing each digit to be controlled independently, and reducing the number of required GPIO pins to 12 instead of 32.
Common Anode (CA)
A common anode display has all the positive terminals (anode connections) of each digit connected together, There are four common pins for digits 1, 2, 3, and 4. To display a character on one of the digits, first, connect the common ping of the desired digit to a power source. Then, connect a suitable current limiting resistor between the cathode of the particular segment (a~g) and the ground to turn on that segment.
Common Cathode
In a common cathode display, the cathode of each LED segment is connected to the negative terminal of the power supply, while the anodes of all LEDs in a digit are connected together. To display a character on a specific digit, you connect the common pin of that digit to the ground and apply a voltage to the desired segment's anode via a current-limiting resistor. This will turn on the corresponding LED segment on the selected digit.