In this tutorial, we will see together how to use a 7-segment display with an Arduino / Genuino board. We will study the operation of a 7-segment display and its use. As a bonus, we'll add a BCD to 7-segment decoder to the edit, to display numbers, without having to do any complicated code.
Hello everyone !
You have all seen and even can use 7-segment displays in your everyday life.
A 7-segment display in its natural environment
The 7-segment displays are LED displays inherited from a now bygone era where everyone could buy their own electronic kit at the local electronics store or by sending their cut-out form in the electronics magazines of the era. Today there are fewer and fewer 7-segment displays in commercial devices. It is a shame, because it is a simple and efficient technology.
No action movie would be complete without a villainous villain with a bomb showing the time left before the explosion on a 7-segment display and beeping every second, so the hero can stop the timer at 00:00:01.
You will understand, in this article, we will learn how to use 7-segment displays with an Arduino board.
7-segment displays
A 7-segment display
7-segment displays are LED displays made up of 7 segments (one LED per segment), which can display numbers and sometimes even letters depending on the application.
A few years ago, 7-segment displays were everywhere: clock radios, watches, calculators, microwaves, ovens, counters, industrial systems, measuring tools, etc. Today, the 7-segment displays have for the most part been replaced by LCD displays or more high-end graphic screens. We only find 7-segment displays in very specific use cases: voltmeter for model making, DIY electronic card or for a niche market, low cost measurement tools, etc.
The 7-segment displays have been forgotten, because too sober, times change, tastes too. But since it is simply a series of LEDs in the same box, in the end, it is a very simple technology to implement. And as they say, often the simplest solution is the best.
Layout of a 7-segment display
The 7-segment displays consist of 7 segments, hence their name. These segments are named A, B, C, D, E, and F by convention, and they appear in the order shown above.
Each segment corresponds to an LED that can be turned on or off to form numbers, letters and even rudimentary special characters. Typically, displays have 7 segments and a "decimal point" which can be used to display floating point numbers or subunits (tenths of a second for example).
PS As we will see in a future article, there are also specialized versions with double points for the hours and apostrophes for the minutes (for American notation).
There are a multitude of 7-segment display colors: red, green, yellow, orange, blue, white, etc. There are a multitude of sizes, from the small display with a side of a few millimeters to several tens of centimeters. You choose ;)
In the end, whatever the color and size of the display, the operating principle is the same.
Numbers from 0 to 9 and letters from A to F
Displaying numbers with a 7-segment display simply turns on the LEDs of the appropriate segments. That's all.
Any fixture / code capable of lighting 7 or 8 LEDs simultaneously is capable of using a 7-segment display. There is no simpler.
I gave you an illustration of the different possible figures with a 7-segment display. If you're having trouble reading the numbers, step back from your screen. Illustration is better than words in this case;) 😉
PS I added in the illustration the letters from A to F, because the display of hexadecimal digits is very classic with 7-segment displays. There is more to life than numbers 0 to 9 in IT;) 😉
If we put side by side the layout diagram of the segments and the state of the segments for each number, we obtain the following table:
Digit | G | F | E | D | C | B | A |
---|---|---|---|---|---|---|---|
0 | OFF | ON | ON | ON | ON | ON | ON |
1 | OFF | OFF | OFF | OFF | ON | ON | OFF |
2 | ON | OFF | ON | ON | OFF | ON | ON |
3 | ON | OFF | OFF | ON | ON | ON | ON |
4 | ON | ON | OFF | OFF | ON | ON | OFF |
5 | ON | ON | OFF | ON | ON | OFF | ON |
6 | ON | ON | ON | ON | ON | OFF | ON |
7 | OFF | OFF | OFF | OFF | ON | ON | ON |
8 | ON | ON | ON | ON | ON | ON | ON |
9 | ON | ON | OFF | ON | ON | ON | ON |
A | ON | ON | ON | OFF | ON | ON | ON |
B | ON | ON | ON | ON | ON | OFF | OFF |
C | OFF | ON | ON | ON | OFF | OFF | ON |
D | ON | OFF | ON | ON | ON | ON | OFF |
E | ON | ON | ON | ON | OFF | OFF | ON |
F | ON | ON | ON | OFF | OFF | OFF | ON |
Keep this table handy for now, it will come in handy a bit later 😉
Trick question: common cathode or anode ?
Examples of 7-segment display references
If you are looking for 7-segment displays on the internet, you will sometimes come across "common cathode" displays and other times "common anode" displays. Kezako?
A two-pin LED: an anode (the +) and a cathode (the -). To control an LED, a current must flow from the anode to the cathode.
Standard pinout of a DC and AC 7-segment display
In the case of 7-segment displays, in order to minimize the number of pins to be wired, the anodes or cathodes are pre-wired together inside the display. So there is always a common pin and 8 separate pins for the segments and the decimal point.
To satisfy everyone, there are therefore two versions of displays: a "common anode" version (abbreviated CA, all the anodes are connected together) and another "common cathode" (abbreviated CC, all cathodes are connected. sets). The difference is subtle, but it involves totally different wiring depending on the type.
In one case, the common pin must be connected to ground (common cathode), in the other to the power supply (common anode). The logic of control is also reversed. In one case, you must connect the power supply to the pin of the segment you want to light. In the other, we must connect the mass to the pin of the segment that we want to light.
In the case of use with an Arduino board, the common anode version results in a LOW = segment on, HIGH = segment off. For the common cathode version, it is more "logical", with LOW = segment off, HIGH = segment on.
Take the time to see which version you should / can use in your edits. Some control circuits (like the CD4511 presented as a bonus for example) it only works with common cathode displays.
If you don't know what to buy, grab common cathode versions. This is the most standard version and the easiest to use.
The demonstration assembly
To understand how to use a 7-segment display, the simplest and to implement one in a test setup;) 😉
To carry out this first assembly, we will need:
- An Arduino UNO board (and its USB cable),
- A 7-segment display with a common cathode,
- Eight 1K ohm resistors - color code brown / black / red,
- A test plate and wires to wire our assembly.
To start the assembly, we wire the GND pin of the Arduino to the common pin of the 7-segment display (middle pin up or down on displays with a "standard" pinout).
We then wire a 1K resistor on each segment of the display (see pinout in the previous chapter) then to the Arduino board by means of a wire. The segments should be wired in the order below:
Segment | Arduino pin |
---|---|
A | 2 |
B | 3 |
C | 4 |
D | 5 |
E | 6 |
F | 7 |
G | 8 |
DP | 9 |
PS The above Arduino pins were chosen totally arbitrarily. You can modify the correspondence of the pins according to your needs and your assembly in the code thereafter if necessary.
The finished assembly
Once the 7 segments and the decimal point are wired, all you have to do is switch to the code 😉 Why 1K ohm resistors?
When we wire an LED on an Arduino board, we generally use 330 ohm resistors, because this allows to have a current of 12mA through the LED and therefore a good brightness. It would therefore be logical to use the same values for the LEDs of a 7-segment display. Or not.There is a small difference between a simple LED and a 7-segment display. An LED is an indicator, designed to be visible, or even to illuminate objects. A 7-segment display is designed for short distance display, so there is no need for high brightness.A 7-segment display is perfectly readable with a current of only 2mA. For use in a slightly bright room, a current of 5mA is sufficient to have sufficient brightness.It is possible to use 330 ohm resistors to obtain a current of 12mA and therefore a very high brightness. But generally this is completely unnecessary.Do not hesitate to test several resistance values between 1.6K ohms and 330 ohms to get an idea of the brightness 😉
The demonstration assembly (common anode version)
For those curious who wish to use a common anode display, here is the wiring:
The assembly is the same, only, the common pin of the display is connected to the 5V pin of the Arduino board, instead of the GND pin.
The code
The purpose of the example code below is surprisingly simple: to display digits from 0 to F (15 in hexadecimal) in a loop, while flashing the decimal point.
1 /* Pins of the different segments of the display */ 2 const byte PIN_SEGMENT_A = 2; 3 const byte PIN_SEGMENT_B = 3; 4 const byte PIN_SEGMENT_C = 4; 5 const byte PIN_SEGMENT_D = 5; 6 const byte PIN_SEGMENT_E = 6; 7 const byte PIN_SEGMENT_F = 7; 8 const byte PIN_SEGMENT_G = 8; 9 const byte PIN_SEGMENT_DP = 9;
We will start this code in a very classic way with the various declarations of constants for the pins.
/* Correspondence table value -> display segment states */ const byte LUT_ETATS_SEGMENTS[] = { 0b00111111, 0b00000110, 0b01011011, 0b01001111, 0b01100110, 0b01101101, 0b01111101, 0b00000111, 0b01111111, 0b01101111, 0b01110111, 0b01111100, 0b00111001, 0b01011110, 0b01111001, 0b01110001 };
We then continue with another constant, an array of bytes, which will contain our correspondence table from number to segments.
You will notice that I have used binary notation in the table in order to make the code more readable for those who would like to verify that my segments correspond to the numbers. 😉
/** Fonction setup() */ void setup() { /* Toutes les broches en sorties */ pinMode(PIN_SEGMENT_A, OUTPUT); digitalWrite(PIN_SEGMENT_A, LOW); pinMode(PIN_SEGMENT_B, OUTPUT); digitalWrite(PIN_SEGMENT_B, LOW); pinMode(PIN_SEGMENT_C, OUTPUT); digitalWrite(PIN_SEGMENT_C, LOW); pinMode(PIN_SEGMENT_D, OUTPUT); digitalWrite(PIN_SEGMENT_D, LOW); pinMode(PIN_SEGMENT_E, OUTPUT); digitalWrite(PIN_SEGMENT_E, LOW); pinMode(PIN_SEGMENT_F, OUTPUT); digitalWrite(PIN_SEGMENT_F, LOW); pinMode(PIN_SEGMENT_G, OUTPUT); digitalWrite(PIN_SEGMENT_G, LOW); pinMode(PIN_SEGMENT_DP, OUTPUT); digitalWrite(PIN_SEGMENT_DP, LOW); }
The setup () function won't do much today. Some pinMode () and some digitalWrite () to set the pins out and to LOW, but nothing more.
/** Function loop() */ void loop() { static byte chiffre = 0; static byte etat_dp = 0; /* Displays the number */ affiche_chiffre_7seg(chiffre, etat_dp); /* Increments the number from 0 to 15 */ if (++chiffre == 16) { chiffre = 0; } /* Flashes the decimal point (inverts the state each time) */ etat_dp = !etat_dp; /* Deadline for the demo */ delay(1000); }
The loop () function is already more interesting. It does four things:
- it displays the current digit by means of the displays_chiffre_7seg () function,
- it increments the value of the digit by 1, starting from 0 if the value exceeds 15,
- it flashes the decimal point by inverting its state,
- she waits a second before starting over.
N.B. The value of the digit and the state of the decimal point are stored in two "static" variables which retain their value between two executions of the loop () function.
/** Function allowing a digit to be displayed on a 7-segment display */ void affiche_chiffre_7seg(byte chiffre, byte dp) { /* Simple security */ if (chiffre > 15) return; // Only accepts values from 0 to 15. /* Conversion of digit -> segment states */ byte segments = LUT_ETATS_SEGMENTS[chiffre]; /* Display */ digitalWrite(PIN_SEGMENT_A, bitRead(segments, 0)); digitalWrite(PIN_SEGMENT_B, bitRead(segments, 1)); digitalWrite(PIN_SEGMENT_C, bitRead(segments, 2)); digitalWrite(PIN_SEGMENT_D, bitRead(segments, 3)); digitalWrite(PIN_SEGMENT_E, bitRead(segments, 4)); digitalWrite(PIN_SEGMENT_F, bitRead(segments, 5)); digitalWrite(PIN_SEGMENT_G, bitRead(segments, 6)); digitalWrite(PIN_SEGMENT_DP, dp); }
The display_chiffre_7seg () function takes care of the display.
It begins by checking that the number is between 0 and 15 (inclusive). It then uses the correspondence table to "convert" the number into a series of states for the segments. Finally, it uses a series of digitalWrite () to write the state of each segment.
The extraction of the state of each segment is performed by the bitRead () function. This function allows you to extract the value of a bit from an integer. Here each bit of the value at the output of the table corresponds to a segment.
For fans of common anode displays, here is the modified code:
/** Function allowing a digit to be displayed on a 7-segment display */ void affiche_chiffre_7seg(byte chiffre, byte dp) { /* Simple security */ if (chiffre > 15) return; // Only accepts values from 0 to 15. /* Conversion chiffre -> états des segments */ byte segments = LUT_ETATS_SEGMENTS[chiffre]; /* Display */ digitalWrite(PIN_SEGMENT_A, !bitRead(segments, 0)); digitalWrite(PIN_SEGMENT_B, !bitRead(segments, 1)); digitalWrite(PIN_SEGMENT_C, !bitRead(segments, 2)); digitalWrite(PIN_SEGMENT_D, !bitRead(segments, 3)); digitalWrite(PIN_SEGMENT_E, !bitRead(segments, 4)); digitalWrite(PIN_SEGMENT_F, !bitRead(segments, 5)); digitalWrite(PIN_SEGMENT_G, !bitRead(segments, 6)); digitalWrite(PIN_SEGMENT_DP, !dp); }
This variant is the same as before, but with an inversion of value for each segment.
The complete code with comments:
/** * Example code for a single 7-segment display. */ /* Pins of the different segments of the display */ const byte PIN_SEGMENT_A = 2; const byte PIN_SEGMENT_B = 3; const byte PIN_SEGMENT_C = 4; const byte PIN_SEGMENT_D = 5; const byte PIN_SEGMENT_E = 6; const byte PIN_SEGMENT_F = 7; const byte PIN_SEGMENT_G = 8; const byte PIN_SEGMENT_DP = 9; /* Uncomment if using a 7-segment display with common ANODE */ //#define _7SEG_COMMON_ANODE /* Correspondence table value -> display segment states */ const byte LUT_ETATS_SEGMENTS[] = { 0b00111111, 0b00000110, 0b01011011, 0b01001111, 0b01100110, 0b01101101, 0b01111101, 0b00000111, 0b01111111, 0b01101111, 0b01110111, 0b01111100, 0b00111001, 0b01011110, 0b01111001, 0b01110001 }; /** Fonction setup() */ void setup() { /* All pins in outputs */ pinMode(PIN_SEGMENT_A, OUTPUT); digitalWrite(PIN_SEGMENT_A, LOW); pinMode(PIN_SEGMENT_B, OUTPUT); digitalWrite(PIN_SEGMENT_B, LOW); pinMode(PIN_SEGMENT_C, OUTPUT); digitalWrite(PIN_SEGMENT_C, LOW); pinMode(PIN_SEGMENT_D, OUTPUT); digitalWrite(PIN_SEGMENT_D, LOW); pinMode(PIN_SEGMENT_E, OUTPUT); digitalWrite(PIN_SEGMENT_E, LOW); pinMode(PIN_SEGMENT_F, OUTPUT); digitalWrite(PIN_SEGMENT_F, LOW); pinMode(PIN_SEGMENT_G, OUTPUT); digitalWrite(PIN_SEGMENT_G, LOW); pinMode(PIN_SEGMENT_DP, OUTPUT); digitalWrite(PIN_SEGMENT_DP, LOW); } /** Fonction loop() */ void loop() { static byte chiffre = 0; static byte etat_dp = 0; /* Displays the number */ affiche_chiffre_7seg(chiffre, etat_dp); /* Increments the number from 0 to 15 */ if (++chiffre == 16) { chiffre = 0; } /* Flashes the decimal point (inverts the state each time) */ etat_dp = !etat_dp; /* Deadline for the demo */ delay(1000); } /** Function allowing a digit to be displayed on a 7-segment display */ void affiche_chiffre_7seg(byte chiffre, byte dp) { /* Simple security */ if (chiffre > 15) return; // Only accepts values from 0 to 15. /* Conversion of digit -> segment states */ byte segments = LUT_ETATS_SEGMENTS[chiffre]; /* Display */ #ifndef _7SEG_COMMON_ANODE digitalWrite(PIN_SEGMENT_A, bitRead(segments, 0)); digitalWrite(PIN_SEGMENT_B, bitRead(segments, 1)); digitalWrite(PIN_SEGMENT_C, bitRead(segments, 2)); digitalWrite(PIN_SEGMENT_D, bitRead(segments, 3)); digitalWrite(PIN_SEGMENT_E, bitRead(segments, 4)); digitalWrite(PIN_SEGMENT_F, bitRead(segments, 5)); digitalWrite(PIN_SEGMENT_G, bitRead(segments, 6)); digitalWrite(PIN_SEGMENT_DP, dp); #else digitalWrite(PIN_SEGMENT_A, !bitRead(segments, 0)); digitalWrite(PIN_SEGMENT_B, !bitRead(segments, 1)); digitalWrite(PIN_SEGMENT_C, !bitRead(segments, 2)); digitalWrite(PIN_SEGMENT_D, !bitRead(segments, 3)); digitalWrite(PIN_SEGMENT_E, !bitRead(segments, 4)); digitalWrite(PIN_SEGMENT_F, !bitRead(segments, 5)); digitalWrite(PIN_SEGMENT_G, !bitRead(segments, 6)); digitalWrite(PIN_SEGMENT_DP, !dp); #endif }
Bonus: use of a BCD decoder - 7 segments
If I tell you that it is possible to control a 7-segment display with only 4 pins (5 if you count the decimal point), that seems impossible, right? Well it is possible thanks to a very nice little logic circuit: the CD4511.
CD4511
The CD4511 is a BCD to 7 segments decoder (sometimes incorrectly called a "4 to 7 demultiplexer"). It allows you to display numbers on 7-segment displays without having to determine the state of each segment yourself. We give it the value of the digit in binary (on 4 bits) and it displays.
The CD4511 can only display digits from 0 to 9. It does not support the display of hexadecimal digits.
The BCD encoding is fairly simple to understand: you take any number, cut it into digits and encode each digit in binary. For example 123 gives 0001 0010 0011 in BCD (0001 = 1, 0010 = 2, 0011 = 3).
N.B. There are variants with other references in the CD4000 and 74HC circuit series. By searching for "bcd to 7 segments decoder" on google you will find a lot of references;)
Pinout of a CD4511
The CD4511 has:
- a power supply pin (VDD) and a ground (VSS),
- four data pins, named A, B, C and D, corresponding to the value of the digit to be displayed (on 4 bits),
- seven pins for the 7 segments of the display,
- three control pins allowing all segments to be switched off (/ BI), all segments to be switched on (/ LT) or to temporarily keep the value in memory (LE).
CD4511 truth table
The working principle of the CD4511 is as follows:
- When the / BI pin is at LOW, the display is completely off.
- When the / LT spindle is at LOW, the display is fully on.
- When the LE pin goes from LOW to HIGH, the value on pins A, B, C and D is held in memory until the LE pin goes back to LOW.
- The rest of the time, the display will show the number corresponding to the binary value on pins A, B, C and D.
N.B. You will notice that the values of pins A, B, C and D between 10 and 15 are empty in the table. The CD4511 can only display digits from 0 to 9.
assembly
In order to understand how this circuit works, we will modify the assembly of the previous chapter to include a CD4511.
Necessary material
To carry out this second assembly, we will need:
- An Arduino UNO board (and its USB cable),
- A 7-segment display with a common cathode,
- Eight 1K ohm resistors - color code brown / black / red,
- A BCD decoder to 7 reference segments CD4511,
- A test plate and wires to wire our assembly.
Schematic view of the assembly
Prototyping view of the assembly
To start this second assembly, we wire the GND pin of the Arduino to the common pin of the 7-segment display (middle pin up or down on the displays with a "standard" pinout), as for the first assembly .
A 1K ohm resistor is then connected to each segment of the display (see pinout in the chapter at the beginning of the article) then to the corresponding one on the CD4511 by means of a wire.
The finished assembly
Finally, you will need to wire the remaining pins of the CD4511 as specified below:
Pin CD4511 | Arduino pin |
---|---|
VSS | GND |
VDD | 5V |
LT | 5V |
BI | 5V |
LE | 0V |
A | 2 |
B | 3 |
C | 4 |
D | 5 |
We will wire the decimal point of the display to pin D6 of the Arduino board, without forgetting the 1K ohm resistor in series between the DP pin of the display and the Arduino board.
PS The Arduino pins for pins A, B, C, D and decimal point have been chosen totally arbitrarily. You can modify the correspondence of the pins according to your needs and your assembly in the code thereafter if necessary.
Extract from the CD4511 manufacturer's sheet
Mounting a CD4511 with a common anode display is much more complicated. In this situation, it is necessary to use transistors on each output pin of the CD4511 to reverse the segment firing logic.
This variant of the assembly will not be studied in this article for the sake of simplicity. 😉
The code
The purpose of this second code is similar to the first: to display digits from 0 to 9 in a loop, while flashing the decimal point.
/* CD4511 and display decimal point pins */ const byte PIN_CD4511_A1 = 2; const byte PIN_CD4511_A2 = 3; const byte PIN_CD4511_A3 = 4; const byte PIN_CD4511_A4 = 5; const byte PIN_SEGMENT_DP = 6;
The code begins like its little brother with the declarations of the constants for pins A, B, C, D and DP of the CD4511 and the display.
/** Setup function() */ void setup() { /* Toutes les broches en sorties */ pinMode(PIN_CD4511_A1, OUTPUT); digitalWrite(PIN_CD4511_A1, LOW); pinMode(PIN_CD4511_A2, OUTPUT); digitalWrite(PIN_CD4511_A2, LOW); pinMode(PIN_CD4511_A3, OUTPUT); digitalWrite(PIN_CD4511_A3, LOW); pinMode(PIN_CD4511_A4, OUTPUT); digitalWrite(PIN_CD4511_A4, LOW); pinMode(PIN_SEGMENT_DP, OUTPUT); digitalWrite(PIN_SEGMENT_DP, LOW); }
The setup () function sets each pin to output and LOW by means of a call to pinMode () and digitalWrite ().
/** Loop function() */ void loop() { static byte chiffre = 0; static byte etat_dp = 0; /* Displays the number */ affiche_chiffre_7seg(chiffre, etat_dp); /* Increments the number from 0 to 9 */ if (++chiffre == 10) { chiffre = 0; } /* Flashes the decimal point (inverts the state each time) */ etat_dp = !etat_dp; /* Deadline for the demo */ delay(1000); }
The code for the loop () function is a copy and paste of the previous code. The only difference is that incrementing the value of the digit limits the maximum value to 9 instead of 15.
/** Function allowing a digit to be displayed on a 7-segment display */ void affiche_chiffre_7seg(byte chiffre, byte dp) { /* Simple security */ if (chiffre > 9) return; // Only accepts values from 0 to 9. /*Display */ digitalWrite(PIN_CD4511_A1, bitRead(chiffre, 0)); digitalWrite(PIN_CD4511_A2, bitRead(chiffre, 1)); digitalWrite(PIN_CD4511_A3, bitRead(chiffre, 2)); digitalWrite(PIN_CD4511_A4, bitRead(chiffre, 3)); digitalWrite(PIN_SEGMENT_DP, dp); }
The code for the show_chiffre_7seg () function is also very similar to the previous version. The code checks that the value of the digit is less than or equal to 9 and sends this value in binary on pins A, B, C and D, without conversion or other.
The complete code with comments:
/** * Code example for a single 7-segment display with a BCD to 7-segment CD4511 decoder. */ /* CD4511 and display decimal point pins */ const byte PIN_CD4511_A1 = 2; const byte PIN_CD4511_A2 = 3; const byte PIN_CD4511_A3 = 4; const byte PIN_CD4511_A4 = 5; const byte PIN_SEGMENT_DP = 6; /** Setup function() */ void setup() { /* All pins in outputs */ pinMode(PIN_CD4511_A1, OUTPUT); digitalWrite(PIN_CD4511_A1, LOW); pinMode(PIN_CD4511_A2, OUTPUT); digitalWrite(PIN_CD4511_A2, LOW); pinMode(PIN_CD4511_A3, OUTPUT); digitalWrite(PIN_CD4511_A3, LOW); pinMode(PIN_CD4511_A4, OUTPUT); digitalWrite(PIN_CD4511_A4, LOW); pinMode(PIN_SEGMENT_DP, OUTPUT); digitalWrite(PIN_SEGMENT_DP, LOW); } /** Loop function() */ void loop() { static byte chiffre = 0; static byte etat_dp = 0; /* Displays the number */ affiche_chiffre_7seg(chiffre, etat_dp); /* Increments the number from 0 to 9 */ if (++chiffre == 10) { chiffre = 0; } /* Flashes the decimal point (inverts the state each time) */ etat_dp = !etat_dp; /* Deadline for the demo */ delay(1000); } /** Function allowing a digit to be displayed on a 7-segment display */ void affiche_chiffre_7seg(byte chiffre, byte dp) { /* Simple security */ if (chiffre > 9) return; // Only accepts values from 0 to 9. /* Display */ digitalWrite(PIN_CD4511_A1, bitRead(chiffre, 0)); digitalWrite(PIN_CD4511_A2, bitRead(chiffre, 1)); digitalWrite(PIN_CD4511_A3, bitRead(chiffre, 2)); digitalWrite(PIN_CD4511_A4, bitRead(chiffre, 3)); digitalWrite(PIN_SEGMENT_DP, dp); }
Conclusion
This tutorial is now complete.
If you enjoyed this tutorial, feel free to comment on it on the forum, post it on social media, and support the site if you like it.