WHAT YOU'LL USE
Match these to your kit
Gather from home
Reuse the parts between missions; these are not 45 simultaneous installations. Red/yellow/green means those three monochrome colours. RGB is a separate component with three channels.
MISSION 42 · INTERMEDIATE ARDUINO
Make memory pattern game. Explore sequence arrays and replay.
5 · Inventor Arcade
Your new skill: Sequence arrays and replay
Revisit the skill you will reuse: joystick combination signal
WHAT YOU'LL USE
Reuse the parts between missions; these are not 45 simultaneous installations. Red/yellow/green means those three monochrome colours. RGB is a separate component with three channels.
BEFORE YOU BUILD
Unplug USB before changing connections. Use only the USB supply for this build; never connect 9V to 5V or a signal pin, and never connect to mains. An adult verifies variant, printed pin labels and resistor values before powering. Stop and unplug if a part becomes hot or damaged.
YOUR REWARD
PREDICT BEFORE YOU BEGIN
Before the test: which input will change, and what signal or reading do you expect?
BEFORE YOU BUILD
Parent check: exact part variant, labelled pins and stated values. If a check cannot be confirmed, keep this physical build unpowered and explore the code and prediction instead.
YOUR CHALLENGE
NEW POWER-UP
Sequence arrays and replay
You have explored sequence recognition and return-to-centre. Now try sequence arrays and replay.
Each coloured strip is one connected group. Different numbered rows stay separate. This explains the board; use the mission’s exact connection reference for component positions. Check rail breaks on your supplied board.
Copy the complete code into Arduino IDE or download the sketch. Follow the matching component card before connecting power.
// First Wonder Brain Bots 42 — Memory Pattern Game
// USB-powered model. Unplug before rewiring. Serial Monitor: 9600 baud.
unsigned long started=0;
int state=0;
int entryIndex=0;
int level=1;
int playIndex=0;
byte pattern[6];
const byte ledPins[]={8,12,13};
const byte buttonPins[]={2,4,7};const byte buttonCount=3;
bool rawButton[4]={HIGH,HIGH,HIGH,HIGH},stableButton[4]={HIGH,HIGH,HIGH,HIGH},pressedEvent[4]={false,false,false,false};
unsigned long changedAt[4]={0,0,0,0};
void scanButtons(unsigned long now){for(byte i=0;i<buttonCount;i++){
pressedEvent[i]=false;bool raw=digitalRead(buttonPins[i]);
if(raw!=rawButton[i]){rawButton[i]=raw;changedAt[i]=now;}
if(now-changedAt[i]>=30&&raw!=stableButton[i]){stableButton[i]=raw;pressedEvent[i]=raw==LOW;}
}}
bool press(byte index){return pressedEvent[index];}
void setup(){Serial.begin(9600);randomSeed(analogRead(A5));pinMode(8,OUTPUT);digitalWrite(8,LOW);pinMode(12,OUTPUT);digitalWrite(12,LOW);pinMode(13,OUTPUT);digitalWrite(13,LOW);pinMode(2,INPUT_PULLUP);pinMode(4,INPUT_PULLUP);pinMode(7,INPUT_PULLUP);Serial.println("Ready. Follow your mission test.");}
void loop(){
unsigned long now=millis();
scanButtons(now);
// Three labelled colour buttons; sequence grows to six. No input deadline.
if(state==0){for(byte i=0;i<6;i++)pattern[i]=random(0,3);level=1;playIndex=0;entryIndex=0;state=1;started=now;}
if(state==1){unsigned long elapsed=now-started;for(byte i=0;i<3;i++)digitalWrite(ledPins[i],elapsed<500&&i==pattern[playIndex]);
if(elapsed>=800){started=now;playIndex++;if(playIndex>=level){state=2;entryIndex=0;for(byte i=0;i<3;i++)digitalWrite(ledPins[i],LOW);Serial.println("Your turn: replay the colours");}}}
else if(state==2){for(byte i=0;i<3;i++){if(press(i)){
if(i!=pattern[entryIndex]){Serial.println("Try the same pattern again");playIndex=0;state=1;started=now;break;}
entryIndex++;if(entryIndex==level){Serial.println("Pattern matched");if(level==6){state=3;Serial.println("Finished! Press any button to replay");}else{level++;playIndex=0;state=1;started=now;}break;}}}}
else if(state==3){for(byte i=0;i<3;i++)if(press(i))state=0;}
}
CONNECTION MAP
BUILD PATH
STEP 1 OF 6
You will explore sequence arrays and replay. Gather the kit and home materials below. Unplug USB. Match the part names and printed labels.
A video demonstration will appear here when it is ready. You can follow the written step now.
You will explore sequence arrays and replay. Gather the kit and home materials below. Unplug USB. Match the part names and printed labels.
WHAT'S REALLY HAPPENING?
Sequence arrays and replay. Check your rule against an example where it should respond and one where it should not. The same level is replayed for another try.
This is a tabletop learning model. Real systems also need reliable power, robust sensors and careful handling of unknown measurements; this kit model is not a safety or security device.
FAIR-TEST CHALLENGE
Change one input or setting at a time; keep the wiring and protection unchanged. Repeat three trials.
WHEN IT DOESN'T WORK YET
Likely cause: Wrong board, port or cable connection
Try this first: Check Arduino Uno selection and supplied data cable. Unplug external wiring before checking upload on built-in LED.
Likely cause: Pin labels, input calibration or variant differs
Try this first: Unplug. Compare every connection with the map. Return to the earlier single-input mission; test one subsystem at a time.
Likely cause: Sensor settling, target, contact or calibration
Try this first: Follow the exact test setup; allow settling, use a flat target or check module pinout unpowered. Never replace unknown with a guessed safe reading.
CLEAN, RESET AND STORE
Disconnect USB, remove wires carefully and store components dry.
NEXT SKILL
Pseudorandom choice and one event per press