Arduino "Reaction Timer" - My Kids Love Playing This

Arduino "Reaction Timer" - My Kids Love Playing This © GPL3+

Wait for light - press a button. So simple but so funny. All our family plays the game.

  • 763 views
  • 5 comments
  • 5 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

About this project

I discovered the code somewhere on the Internet and tried it.

All my family loved the game and I decided to assemble it in a funny case to be able to play.

The work is now finished and it is into the hands of my kids.

It is a very basic project but in a kind of case which hides all elements.

Here are some pictures:

Please do not hesitate to ask me questions if needed.

Code

Here's the codeArduino
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#define btnSTART 5
#define btnHIT 7
#define ledTrigger 9
LiquidCrystal_I2C lcd(0x23,20,4);

void setup() {
  lcd.init(); 
  lcd.backlight();
  pinMode(btnSTART, INPUT_PULLUP);
  pinMode(btnHIT, INPUT_PULLUP);
  pinMode(ledTrigger, OUTPUT);
  digitalWrite(ledTrigger, LOW);
  lcd.print("Salut Famille!");
  delay(2000);
  lcd.clear();
  randomSeed(analogRead(0));
}

void loop() {
  long timeReaction;
  long timeTotal = 0;
  lcd.print("Press START!");
  while (digitalRead(btnSTART)) {}
  delay(10);
  while (!digitalRead(btnSTART)) {}
  lcd.clear();
  lcd.print("Jouez!!!");
  delay(1000);
  for (int i = 0; i < 5; i++) {
    delay(random(500, 5000));
    timeReaction = millis();
    digitalWrite(ledTrigger, HIGH);
    while (digitalRead(btnHIT)) {}
    timeReaction = millis() - timeReaction;
    timeTotal += timeReaction;
    delay(10);
    while (!digitalRead(btnHIT)) {}
    digitalWrite(ledTrigger, LOW);
    lcd.clear();
    lcd.print(i + 1);
    lcd.print(": ");
    lcd.print(timeReaction);
    delay(1000);
  }
  lcd.clear();
  lcd.print("Moyenne = ");
  lcd.print(timeTotal/5);
  delay(10000);
  lcd.clear();
  }

Schematics

My first fritzing essay
reaction_timer_nFqVp0hMaj.fzz

Comments

Similar projects you might like

Cube for Kids

Project tutorial by Thomas Angielsky

  • 2,086 views
  • 0 comments
  • 8 respects

sC00p-4-b1l1tY Meter

Project showcase by Team sC00p-4-b1l1tY

  • 985 views
  • 2 comments
  • 4 respects

LCD Game

Project showcase by Team Iron_SalsaStudio

  • 11,724 views
  • 10 comments
  • 20 respects

Electronic Wind DIY Pinwheel

Project tutorial by Francesco Guerri

  • 4,031 views
  • 0 comments
  • 9 respects

Reaction Timer - F1 Style

Project tutorial by LAGSILVA

  • 2,085 views
  • 2 comments
  • 10 respects

Jigsaw Puzzle Timer

Project tutorial by HomeMadeGarbage

  • 1,856 views
  • 1 comment
  • 4 respects
Add projectSign up / Login