Overview
Same wiring and program structure as LUCE, with a different set of patterns. Comparing the two shows that once the wiring is fixed, new characters are only a matter of new rows of 1s and 0s.
You will need
- Arduino Uno R3 and USB cable
- One common-cathode seven-segment display
- 8 × 330 Ω resistors
- 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
{1,1,1,0,1,1,1,0}, // A
{1,1,1,1,1,1,0,0}, // O
{1,0,1,1,0,1,1,0} // S
};
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
Note that O and the digit 0 use the same pattern, and S matches the digit 5. Seven segments can show only some letters clearly; K, M, V, W and X have no good form.
Review result: no changes were needed. Decoded patterns: A lights a, b, c, e, f, g; O lights a–f; S lights a, c, d, f, g. All correct for a common-cathode display wired a–dp to pins 2–9.
What you should observe
- L, A, O and S appear for one second each, followed by half a second of blank display.
- Inverted letters mean a common-anode display; scrambled shapes mean swapped segment wires.