What is a DIP Switch?
A DIP switch (Dual In-line Package) is a set of miniature slide switches in one housing. Each switch is independent — a tiny, deliberate, physical ON/OFF that survives power cycles. That permanence is the point: it's how devices store settings without any code.
Your Kit's DIP Switch
A 3-switch DIP with 6 pins — two rows of 3, one pin pair per switch (that's the "dual in-line" part):
ON
┌───────────┐
│ [1][2][3] │ ← slide a toggle toward ON
└───────────┘
│ │ │ ← 3 pins on the front row
(3 more pins directly behind)
Inside, each switch is nothing but a sliding metal bridge between its front pin and the pin directly behind it. ON = bridged, OFF = open. Switch 1 owns the left pair, switch 2 the middle, switch 3 the right.
Wiring: The Pull-Down Pattern
Wire each switch like a button, the way every mission does it:
5V → switch → input pin, plus a 10kΩ pull-down resistor from the input pin to GND.
Why the resistor? An input pin connected to nothing doesn't read LOW — it floats, picking up noise and reading random garbage. When the switch is OFF, the 10kΩ drains the pin to a solid LOW; when it's ON, 5V wins and the pin reads HIGH. Result: ON = HIGH, no surprises.
(The alternative — INPUT_PULLUP with the switch wired to GND — needs no resistor but inverts the logic: ON reads LOW. The missions stick with pull-downs so the code reads naturally.)
The Day 4 mission wires switches 1–3 to pins 2, 3, and 4.
Switches Are Bits
Each switch is one binary digit. Three switches = a 3-bit number = 8 distinct settings from one component:
| SW3 | SW2 | SW1 | Value | |-----|-----|-----|-------| | off | off | off | 0 | | off | off | ON | 1 | | off | ON | off | 2 | | off | ON | ON | 3 | | ON | ON | ON | 7 |
In code: value = s1 + (s2 * 2) + (s3 * 4); — the same place-value idea as decimal, just base 2. This is your first real contact with binary, and the later missions cash it in as configuration panels.
Where You'll Use It
| Mission | What it does | |---------|--------------| | Day 3 | Your first input: one switch turns the lander's light on | | Day 4 | Three switches, three lights — cabin, storage, cockpit | | Day 24 | Configuration input for the return to orbit | | Day 27–29 | Autopilot / landing gear mode panels |
Use Cases Beyond the Kit
- Mode selection: pick one of 8 behaviors at power-up, no reprogramming
- Hardware addressing: real I2C modules use DIP switches to set their bus address
- Debug flags: flip features on/off while testing
Common Mistakes
- Random flickering readings: the pull-down resistor is missing — the pin is floating
- Always reads HIGH: pull-down connected to 5V instead of GND, or switch bridging the wrong pair
- Works upside down (ON reads LOW): you've accidentally built the pull-up variant — either flip the wiring or flip the logic in code