7 Segment Display
Component | 7 Segment Display |
Type | Output |
Introduction | If you like to display the time, score or any number without too much effort. |
Introduction
A 7-segment display is a type of electronic display device that can display decimal numbers and some alphabets. It is made up of seven LEDs arranged in a rectangular fashion. Each LED is called a segment. The display can be used to display numbers, letters, and some special characters. It is commonly used in digital clocks, electronic meters, and other electronic devices that display numerical information.
To control a 7 segment display, especially 4 or 8 in a row, you need quite a few wires. This is why we use a 7 segment display driver, which you connect to your micocontroller using I2C or SPI, this way you only need 2 - 4 wires to control all displays.
We have two laying around:
- TM1637 (4 digits, 7 segment display, I2C, time-dots)
- MAX7219 (8 digits, 7 segment display, SPI, decimal points)
Pin Description
Both displays have a different pin layout, but they are both controlled using I2C. The TM1637 has 4 pins, VCC, GND, SDA, and SCL. The MAX7219 has 5 pins, VCC, GND, DIN, CS, and CLK.
By using a library, you can control the display with just a few lines of code.
Code Example
The following code example shows how to use the TM1637Display library to control a 4 digit 7 segment display.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
The following code example shows how to use the max7219 library to control a 8 digit 7 segment display.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Make sure you have the correct library installed, and the correct pins are defined.