Arduino 7-segment Display
The purpose of this project is to find out how a 7-segment display works. To try this out, I also use 2 buttons and a potentiometer. These produce various outputs: a carousel-like show and a value that corresponds to the potentiometer position.
Supplies
1 computer with arduino IDE
1 Arduino Uno
1 USB cable
1 breadboard
1 7-segment display
2 push buttons
1 resistor 220 Ohms
2 resistors 10 kOhms
1 potentiometer 5 kOhms
This is the very common 7-segment display I use. The yellow numbers show to which digital outputs I connected the segments.
the wiring using a breadbord
And finally the source code c++. I have defined 2 arrays that contain numbers on the one hand and some letters on the other hand for output.
I didn't like the behavior of the push buttons. That's why I created a kind of button debouncing: function readButton.
I have prepared the values 0 to 1023 returned by the potentiometer so that they either display the values 0 to 9 or empty, A to I,switchable with the 2nd button. The 1st button shows this segment carousel