Candy Cane Conundrum
Arduino Technical Guide

How to Program and Upload the Arduino Sketch
Primary File: 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.

Required Software

Arduino IDE:

Required Libraries (install via Library Manager):

  1. LiquidCrystal_I2C - For I2C LCD displays
  2. FastLED - For WS2812B addressable LED strips
To Install Libraries: In Arduino IDE, go to Tools → Manage Libraries, search for each library name, and click Install.

Hardware Connection Guide

Arduino Board Selection

Pin Assignments

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
I2C Display Address: The sketch uses I2C address 0x27. If your display uses a different address (common: 0x3F), update this line in the sketch:
LiquidCrystal_I2C lcd(0x27, 20, 4);

Programming Each Station

Step 1: Select Difficulty Level

Open candy_cane_conundrum.ino in Arduino IDE.

Find these lines at the top of the file:

// #define DIFFICULTY_EASY // #define DIFFICULTY_MEDIUM // #define DIFFICULTY_HARD #define DIFFICULTY_EXPERT // <-- Currently set to EXPERT

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
Example for Easy Station:
#define DIFFICULTY_EASY ← Remove the // at start
// #define DIFFICULTY_MEDIUM
// #define DIFFICULTY_HARD
// #define DIFFICULTY_EXPERT

Step 2: Connect Arduino to Computer

  1. Connect Arduino board to computer via USB cable
  2. In Arduino IDE, select correct board: Tools → Board → Arduino Uno (or Mega)
  3. Select correct port: Tools → Port → (select USB port)

Step 3: Compile and Upload

  1. Click Verify button (checkmark icon) to compile the sketch
  2. If no errors, click Upload button (arrow icon)
  3. Wait for upload to complete (status bar shows "Done uploading")
Upload Time: Takes approximately 10-30 seconds depending on board and complexity.

Step 4: Test the Station

  1. Open Serial Monitor: Tools → Serial Monitor
  2. Set baud rate to 9600
  3. Test Phase 1 with correct sequence
  4. Test Phase 2 mechanics (varies by difficulty)
  5. Verify candy cane lights up green on success, red on failure

Solutions Reference

Use this table to verify stations are working correctly:

PRIMARY SYSTEMS (Easy) - 12 Total Button Presses

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

SECONDARY SYSTEMS (Medium) - 13 Total Button Presses

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)

ADVANCED SYSTEMS (Hard) - 27 Total Button Presses

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

MASTER CONTROL (Expert) - 27 Total Button Presses

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)

Phase 2 Mechanics Overview

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)

Customization Options

Adjust Timeout Duration

Default timeout is 120 seconds (2 minutes). To change, modify this line:

const unsigned long TIMEOUT_MS = 120000; // 120 seconds

Change 120000 to desired milliseconds (e.g., 180000 for 3 minutes).

Adjust LED Brightness

Default brightness is 100 (out of 255). To change, modify this line in setup():

FastLED.setBrightness(100);

Increase for brighter (max 255), decrease for dimmer.

Adjust LED Count

Default is 50 LEDs. To match your candy cane tube, modify this line:

#define LED_COUNT 50

Change Display Size

Default display is 20 columns × 4 rows. For different size, modify this line:

LiquidCrystal_I2C lcd(0x27, 20, 4); // columns, rows

Adjust Phase 2 Timing (Hard Difficulty)

Hard difficulty uses reaction speed timing. To adjust:

const unsigned long RAPID_PART1_TIMING = 1500; // 1.5 seconds const unsigned long RAPID_PART2_TIMING = 1000; // 1 second const unsigned long RAPID_PART3_TIMING = 750; // 0.75 seconds

Increase values to give players more time, decrease to make it harder.

Troubleshooting

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)

Serial Monitor Debugging

The sketch includes Serial.println() debug statements. To view them:

  1. Connect Arduino to computer via USB
  2. Open Serial Monitor: Tools → Serial Monitor
  3. Set baud rate to 9600
  4. Press buttons and observe output

Expected output when buttons are pressed:

Phase 1 - Button pressed: 1 Phase 1 - Button pressed: 2 Phase 1 - Button pressed: 3 Complete success! Station reset
Tip: Leave Serial Monitor open during initial testing to verify all buttons are registering correctly and to debug Phase 2 mechanics.

Production Deployment

Programming Checklist for All 8 Stations

  1. Program 2 Easy stations (set #define DIFFICULTY_EASY)
  2. Program 2 Medium stations (set #define DIFFICULTY_MEDIUM)
  3. Program 2 Hard stations (set #define DIFFICULTY_HARD)
  4. Program 2 Expert stations (set #define DIFFICULTY_EXPERT)
  5. Test Phase 1 on each station with correct solution sequence
  6. Test Phase 2 on each station (varies by difficulty)
  7. Label each Arduino board with difficulty level
  8. Keep 1-2 backup pre-programmed Arduinos (one of each difficulty)
Pro Tip: Write the difficulty level on a piece of tape and attach to each Arduino board before installing in stations. This makes troubleshooting easier if you need to swap boards later.

Testing Phase 2 Mechanics

Additional Resources