candy_cane_conundrum.ino - This is the Arduino sketch file containing all code for all 4 difficulty levels with dual-phase gameplay. This guide explains how to configure and upload it to each station.
Arduino IDE:
https://www.arduino.cc/en/softwareRequired Libraries (install via Library Manager):
| Component | Easy (3 btns) | Medium (4 btns) | Hard (5 btns) | Expert (8 btns) |
|---|---|---|---|---|
| Button Inputs | 22, 24, 26 | 22, 24, 26, 28 | 22, 24, 26, 28, 30 | 22, 24, 26, 28, 30, 32, 34, 36 |
| Button LEDs | 23, 25, 27 | 23, 25, 27, 29 | 23, 25, 27, 29, 31 | 23, 25, 27, 29, 31, 33, 35, 37 |
| Display (I2C) | SDA=20, SCL=21 | |||
| LED Strip | Pin 6 | |||
0x27. If your display uses a different address (common: 0x3F), update this line in the sketch:LiquidCrystal_I2C lcd(0x27, 20, 4);
Open candy_cane_conundrum.ino in Arduino IDE.
Find these lines at the top of the file:
Uncomment ONLY ONE line to select the difficulty level for this station:
| Station Type | Uncomment This Line | Buttons | Total Presses |
|---|---|---|---|
| Easy | #define DIFFICULTY_EASY |
3 buttons | 12 presses |
| Medium | #define DIFFICULTY_MEDIUM |
4 buttons | 13 presses |
| Hard | #define DIFFICULTY_HARD |
5 buttons | 27 presses |
| Expert | #define DIFFICULTY_EXPERT |
8 buttons | 27 presses |
#define DIFFICULTY_EASY ← Remove the // at start// #define DIFFICULTY_MEDIUM// #define DIFFICULTY_HARD// #define DIFFICULTY_EXPERT
Use this table to verify stations are working correctly:
| Phase | Solution |
|---|---|
| Phase 1 | Buttons 2 → 3 → 1 (GREEN → BLUE → RED) |
| Phase 2 Part 1 | Button 2 (GREEN) × 3 times |
| Phase 2 Part 2 | Button 1 (RED) × 4 times, then Button 3 (BLUE) × 2 times |
| Phase | Solution |
|---|---|
| Phase 1 | Buttons 2 → 4 → 1 → 3 (GREEN → SILVER → RED → YELLOW) |
| Phase 2 Part 1 | REVERSE of [2, 4] = Buttons 4 → 2 (SILVER → GREEN) |
| Phase 2 Part 2 | REVERSE of [1, 3, 2] = Buttons 2 → 3 → 1 (GREEN → YELLOW → RED) |
| Phase 2 Part 3 | REVERSE of [4, 2, 1, 3] = Buttons 3 → 1 → 2 → 4 (YELLOW → RED → GREEN → SILVER) |
| Phase | Solution |
|---|---|
| Phase 1 | Buttons 1 → 2 → 3 → 4 → 5 |
| Phase 2 Part 1 | Press AS they light (1.5s): 2 → 1 → 3 → 4 → 5 |
| Phase 2 Part 2 | Press AS they light (1s): 5 → 2 → 1 → 3 → 4 → 2 → 1 |
| Phase 2 Part 3 | Press AS they light (0.75s): 3 → 4 → 2 → 5 → 1 → 3 → 4 → 2 → 1 → 5 |
| Phase | Solution |
|---|---|
| Phase 1 | Buttons 1 → 7 → 4 → 5 → 8 |
| Phase 2 Round 1 | Buttons 2 → 6 → 5 → 3 (4 buttons) |
| Phase 2 Round 2 | Buttons 8 → 1 → 4 → 7 → 2 (5 buttons, NEW sequence) |
| Phase 2 Round 3 | Buttons 3 → 5 → 1 → 8 → 6 → 4 (6 buttons, NEW sequence) |
| Phase 2 Round 4 | Buttons 7 → 4 → 2 → 6 → 3 → 1 → 8 (7 buttons, NEW sequence) |
| Difficulty | Phase 2 Mechanic | Skill Tested |
|---|---|---|
| Easy | Power Pulse Count - Watch buttons flash, count flashes, press that many times | Counting (2 parts: 1 button, then 2 buttons) |
| Medium | Zone Reactivation - Watch sequence, press in REVERSE order | Working memory + mental reversal (3 parts: 2, 3, 4 buttons) |
| Hard | Rapid System Check - Press buttons AS they light up | Reaction speed (3 parts: 5, 7, 10 buttons with increasing speed) |
| Expert | Memory Sequences - Watch pattern, repeat from memory | Button position memory (4 independent rounds: 4, 5, 6, 7 buttons) |
Default timeout is 120 seconds (2 minutes). To change, modify this line:
Change 120000 to desired milliseconds (e.g., 180000 for 3 minutes).
Default brightness is 100 (out of 255). To change, modify this line in setup():
Increase for brighter (max 255), decrease for dimmer.
Default is 50 LEDs. To match your candy cane tube, modify this line:
Default display is 20 columns × 4 rows. For different size, modify this line:
Hard difficulty uses reaction speed timing. To adjust:
Increase values to give players more time, decrease to make it harder.
| Problem | Solution |
|---|---|
| Compile error: "LiquidCrystal_I2C not found" | Install LiquidCrystal_I2C library via Library Manager |
| Compile error: "FastLED not found" | Install FastLED library via Library Manager |
| Display shows garbled text | Check I2C address - try changing 0x27 to 0x3F in sketch |
| Display shows nothing | Check wiring (SDA/SCL pins), verify display has power, adjust contrast potentiometer on display backpack |
| Buttons don't respond | Check button wiring, verify pull-down resistors are connected, test button with multimeter |
| LED strip doesn't light up | Check data pin connection (pin 6), verify power supply to LED strip, check LED_COUNT matches actual strip length |
| Upload fails: "Port not found" | Reconnect USB cable, select correct port in Tools → Port menu, install CH340 drivers if using clone boards |
| Station resets randomly | Check power supply - may be under-powered. Use higher amperage power supply (5V 5A recommended) |
| Phase 2 doesn't start (Easy/Medium/Hard) | Verify Phase 1 solution is correct. Check Serial Monitor for debugging output. |
| Expert flashing buttons don't work | Check BUTTON_LED_PINS wiring for buttons 6, 7, 8. Verify flashing only during Phase 1. |
| Hard difficulty too fast/slow | Adjust RAPID_PART timing constants in code (see Customization Options) |
The sketch includes Serial.println() debug statements. To view them:
Expected output when buttons are pressed:
#define DIFFICULTY_EASY)#define DIFFICULTY_MEDIUM)#define DIFFICULTY_HARD)#define DIFFICULTY_EXPERT)https://www.arduino.cc/reference/en/https://fastled.io/