What is a 7-Segment Display?
A 7-segment display is seven LED bars (labeled a–g, plus a decimal point) arranged in a figure-8. Light the right combination and you get any digit 0–9 — and a surprising number of letters. It's the display technology of alarm clocks, microwaves, and every countdown timer in every movie.
Segment Map
─── a ───
│ │
f b
│ │
─── g ───
│ │
e c
│ │
─── d ─── (dp)
Digit Patterns
| Digit | a | b | c | d | e | f | g | |-------|---|---|---|---|---|---|---| | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | | 2 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | | 3 | 1 | 1 | 1 | 1 | 0 | 0 | 1 | | 4 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | | 5 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | | 6 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | | 7 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | | 8 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | | 9 | 1 | 1 | 1 | 1 | 0 | 1 | 1 |
Your Kit's Display: TM1637 4-Digit Module
Driving 4 digits × 8 segments raw would eat 12+ pins and require constant multiplexing (rapidly lighting one digit at a time, faster than your eye can catch). Your kit skips all that: a TM1637 driver chip on the module handles the scanning, and you talk to it over just two wires:
| Module Pin | HERO Pin (missions) | |------------|---------------------| | CLK | Pin 6 | | DIO | Pin 5 | | VCC | 5V | | GND | GND |
It also has a colon between digits 2 and 3 (hello, clock projects) and 8 brightness levels.
The TM1637Display Library
#include <TM1637Display.h>
TM1637Display display(6, 5); // CLK, DIO
| Function | What it does | |----------|--------------| | setBrightness(0–7) | 0 = dim, 7 = blinding | | showNumberDec(n) | Show a number, right-aligned | | showNumberDec(n, true) | With leading zeros: 0042 | | showNumberDecEx(n, 0b01000000) | Number with the colon lit | | setSegments(data[], len, pos) | Raw segment control — custom characters | | clear() | Blank the display |
Custom Characters
setSegments() takes one byte per digit, one bit per segment (bit 0 = a … bit 6 = g, bit 7 = decimal point). OR the named SEG_x constants together. This is exactly how Day 19's depth gauge spells words:
const byte done[] = {
SEG_B | SEG_C | SEG_D | SEG_E | SEG_G, // d
SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F, // O
SEG_C | SEG_E | SEG_G, // n
SEG_A | SEG_D | SEG_E | SEG_F | SEG_G // E
};
display.setSegments(done);
Not every letter survives seven segments (no good M or W), but dOnE, HOLd, nOPE, PLAY, StOP all read fine — the missions lean on this trick.
Where You'll Use It
| Mission | What it does | |---------|--------------| | Day 16 | First numbers on the display | | Day 17 | A ciphered message to decode | | Day 18–19 | The depth gauge for your ascent — including HOLd and nOPE lockout messages | | Day 23–24 | Launch countdown | | Day 27–29 | Autopilot and landing gear readouts |
Common Mistakes
- Nothing displays: CLK and DIO swapped — it's the #1 TM1637 bug, swap and retry
- Still nothing: brightness set to 0, or
setBrightness()never called after power-up - Gibberish segments: a hand-built
setSegmentsmask has the wrong bits — check against the segment map above - Number won't fit: it shows the last 4 digits only; 12345 displays as 2345