7-Segment Display (Common Cathode / Common Anode)

A 7-Segment Display consists of eight individual LEDs (seven bar segments named A through G, plus a decimal point DP) arranged in a figure-8 pattern.

Displays8 blocksMicroPythonC++
7-Segment Display

At a glance

Pins and properties exactly as the circuit editor and simulator define this part. The text below explains how to use them.

Pinout

Pinout of the 7-Segment Display, drawn as in the circuit editor. Select a label to see that pin in the table below.

Pins

Pins of this part
PinLabelType
GGSignal in
FFSignal in
COM_TOPCOMBidirectional
AASignal in
BBSignal in
EESignal in
DDSignal in
COM_BOTCOMBidirectional
CCSignal in
DPDPSignal in

Properties

What you can change in the Property Inspector.

Properties of this part
PropertyRange or choicesDefault
Common TypeCommon Cathode (COM → GND), Common Anode (COM → VCC)Common Cathode (COM → GND)
LED Color#ff0000
Segment Off#1a0505
Max Current10 to 50 mA20 mA

A 7-Segment Display consists of eight individual LEDs (seven bar segments named A through G, plus a decimal point DP) arranged in a figure-8 pattern. It is widely used to display numeric digits 0 through 9 and simple status characters.


1. Hardware Specifications & Segment Topology

  • Operating Voltage: ~2.0V to 3.2V per segment, depending on LED color (see the color note in Section 6). Requires a 220Ω-class series resistor per segment line.
  • Display Configuration (commonType): This component supports both wiring conventions, switchable via a Property Inspector setting (Section 3) — a real prop, not just documentation:
    • Common Cathode (CC) — default: all 8 LED cathodes tied to the COM pin(s), wired to GND. Driving a segment pin HIGH turns that segment ON.
    • Common Anode (CA): all 8 LED anodes tied to the COM pin(s), wired to VCC. Driving a segment pin LOW turns that segment ON.
  • Pin Configuration — a real 10-pin, 5×2 breadboard-style header, with the two COM pins internally bridged to the same net (wire either one, both are electrically identical):
    • Top row (left→right): G, F, COM, A, B
    • Bottom row (left→right): E, D, COM, C, DP
      ── A ──
  │           │
  F           B
  │           │
      ── G ──
  │           │
  E           C
  │           │
      ── D ──    [DP]

2. How it Works (8-Bit Segment Mapping Tables)

Digits 0 through 9 are formed by lighting specific combinations of segments (this table is always in Common-Cathode "1 = segment ON" terms — invert every bit if wired Common Anode):

DigitSegment Pattern (A B C D E F G DP)Bit StringHex Byte
0A, B, C, D, E, F ON111111000xFC
1B, C ON011000000x60
2A, B, D, E, G ON110110100xDA
3A, B, C, D, G ON111100100xF2
4B, C, F, G ON011001100x66
5A, C, D, F, G ON101101100xB6
6A, C, D, E, F, G ON101111100xBE
7A, B, C ON111000000xE0
8All segments A–G ON111111100xFE
9A, B, C, D, F, G ON111101100xF6

3. Component Properties (Property Inspector)

  • Common Type (commonType): Switches the simulated wiring convention (Section 1).
    • Default: common-cathode
    • Options: common-cathode (COM → GND), common-anode (COM → VCC)
  • LED Color (onColor): The lit-segment color — any hex value, not a fixed enum.
    • Default: #ff0000
  • Segment Off (offColor): The unlit-segment color.
    • Default: #ffffff
  • Max Current (maxCurrent): Rated maximum current per segment — exceeding this by 50% trips an OVERCURRENT fault.
    • Default: 20 mA
    • Range: 10 mA to 50 mA

[!NOTE] There's no "Displayed Digit" property — you can't set the digit directly in the Property Inspector. What's shown is always driven by the real simulated current through each segment (see Section 6), which the Blockly blocks below control by writing to the segment pins, exactly like on real hardware.


4. Supported Blockly Blocks

Drawing the blocks…

5. Simulator Behavior

  • Per-Segment Real Current: Each of the 8 segments is its own simulated LED diode — brightness/glow comes from that segment's real branch current, not a scripted "digit lookup." Displaying digit "2" looks correct because the exact segments the SPICE model puts real current through happen to spell out a 2, the same way a real 7-segment display works.
  • Color Physics: The LED Color property isn't just cosmetic — picking a hue buckets the simulated forward-voltage into the same real datasheet-grounded classes the single-color LED component uses: red/amber (AlGaInP, ~2.0V), green (InGaN, ~2.4V), blue/white/other (InGaN, ~3.2V). Changing color genuinely changes the simulated electrical behavior, not just the render color.
  • Fault Detection: Any single segment drawing more than 1.5× Max Current trips an OVERCURRENT fault ("reduce current-limiting resistor value").
7-Segment Display (Common Cathode / Common Anode) — OMS Parts