Overview
A single seven-segment digit spells the word LUCE one letter at a time, holding each for a second, then goes dark for half a second before starting again. Each letter is stored as a row of eight 1s and 0s, one per segment.
You will need
- Arduino Uno R3 and USB cable
- One common-cathode seven-segment display (0.56" is typical)
- 8 × 330 Ω resistors (220–1 kΩ is fine)
- Breadboard and jumper wires
Wiring
| Uno pin | Connects to | Notes |
|---|---|---|
| 2 | Segment a (top) through 330 Ω | HIGH = lit |
| 3 | Segment b (upper right) through 330 Ω | HIGH = lit |
| 4 | Segment c (lower right) through 330 Ω | HIGH = lit |
| 5 | Segment d (bottom) through 330 Ω | HIGH = lit |
| 6 | Segment e (lower left) through 330 Ω | HIGH = lit |
| 7 | Segment f (upper left) through 330 Ω | HIGH = lit |
| 8 | Segment g (middle) through 330 Ω | HIGH = lit |
| 9 | Segment dp (decimal point) through 330 Ω | HIGH = lit |
| GND | Display common cathode (COM) | Usually two COM pins; connect one or both. |
How the pins are arranged
The display must be a common-cathode seven-segment digit. Its common pin goes to GND
and each segment lights when its Uno pin is HIGH (active-high). The pattern arrays list the eight
segments in the order a, b, c, d, e, f, g, dp, which the sketch maps to pins 2 through 9:
characterPatterns[i][segmentPin - 2].
Every segment needs its own resistor (220–1 kΩ; 330 Ω is a good default). Do not use a single resistor on the common pin: the brightness would change with the number of lit segments. On a common-anode display the logic is reversed (common to 5V, segment on when LOW), so this sketch would show the inverse of each letter. See Common anode vs common cathode.
Segment pin positions differ between display models. Check the datasheet for your part, or find each segment with a 5 V supply and a 1 kΩ resistor before wiring.
Diagrams
The sketch
int segmentPin;
int characterPatterns[4][8] = {
{0,0,0,1,1,1,0,0}, // L
{0,1,1,1,1,1,0,0}, // U
{1,0,0,1,1,1,0,0}, // C
{1,0,0,1,1,1,1,0} // E
};
void setup() {
for (segmentPin = 2; segmentPin <= 9; segmentPin++) {
pinMode(segmentPin, OUTPUT);
digitalWrite(segmentPin, LOW);
}
}
void loop() {
for (int characterIndex = 0; characterIndex < 4; characterIndex++) {
for (segmentPin = 2; segmentPin <= 9; segmentPin++) {
digitalWrite(segmentPin, characterPatterns[characterIndex][segmentPin - 2]);
}
delay(1000);
}
for (segmentPin = 2; segmentPin <= 9; segmentPin++) {
digitalWrite(segmentPin, LOW);
}
delay(500);
}How the code works
The outer loop walks through the four letters; the inner loop writes all eight segments
for the current letter. segmentPin - 2 converts a pin number (2–9) into an array column (0–7).
Writing a 1 with digitalWrite() is the same as writing HIGH.
Review result: no changes were needed. We decoded every row against the a–g, dp order: L lights d, e, f; U lights b, c, d, e, f; C lights a, d, e, f; E lights a, d, e, f, g. All four are correct for a common-cathode display.
What you should observe
- L, U, C and E appear in turn, one second each, then the display is blank for half a second.
- The decimal point never lights (its column is 0 in every row).
- If you see the letters "inside out" (everything lit except the letter), your display is common-anode.
- If the shapes are scrambled, two or more segment wires are swapped; compare against the segment map.