BeginnerGames

Pico Reaction-Time Game

A light turns on after a random pause; press a button quickly and see your reaction time in milliseconds.

Estimated time: 45โ€“60 minutes ยท Skills: GPIO, button inputs, timing, basic C++

Parts from the database

Other supplies

Amazon links may be affiliate links. As an Amazon Associate, Electronics Hobby Hub earns from qualifying purchases.

Connections

  1. LED anode through 330 ฮฉ to GP15; LED cathode to GND.
  2. Pushbutton between GP14 and GND; the program enables the internal pull-up.
  3. Power the Pico by USB and use 3.3 V GPIO only.

Build steps

  1. Install the Raspberry Pi Pico Arduino board package and select the correct Pico/port.
  2. Wire LED and button as listed; check LED polarity.
  3. Upload the sketch. Wait for the LED to light, then press the button.
  4. Try five rounds and compare your best and average times; add a display later as an extension.

Software and firmware setup

const int led=15, buttonPin=14;
void setup(){ pinMode(led,OUTPUT); pinMode(buttonPin,INPUT_PULLUP); Serial.begin(115200); randomSeed(analogRead(A0)); }
void loop(){
  digitalWrite(led,LOW); Serial.println("Wait..."); delay(random(1500,5000));
  digitalWrite(led,HIGH); unsigned long start=micros();
  while(digitalRead(buttonPin)==HIGH) { }
  unsigned long elapsed=(micros()-start)/1000; digitalWrite(led,LOW);
  Serial.printf("Reaction: %lu ms\n",elapsed);
  delay(1200); while(digitalRead(buttonPin)==LOW) { }
}

Review the pin assignments in the sketch against the wiring table before uploading.

Test your build

The Serial Monitor should show the reaction time after each press. A false start currently ends the wait early; improving false-start detection is a good extension.

Troubleshooting

  • If the LED stays off, reverse its leads or verify GP15.
  • If the button seems always pressed, it may be wired to 3V3 instead of GND.
  • If upload fails, hold BOOTSEL while reconnecting the Pico and select the new drive/port as instructed by the board package.

Safety and limitations

Use the Pico's USB supply; never connect an external 5 V signal to a Pico GPIO pin.

Manufacturer and platform documentation

Community Notes for This Project

These are unverified visitor contributions, separate from the build guide and manufacturer specifications. Verify technical advice against the linked datasheets before relying on it.

Set up the comments service to load community notes.

Share a tip or question about this build

โ† Browse all projects