Skip to content

hyankov/reaction_time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Game Rules

The player holds his hand over the sensor for a few seconds and that starts the game. Two RGB (Red, Green, Blue) LEDs start flashing in different colors. At a random time they will stop flashing and will remain lit, with the same color (e.g. both would become Blue). The player has to react as quick as possible and move his hand away from the sensor. The reaction time is recorded. The game is keeping track of the best reaction time so far. If the player moves their hand away from the sensor, before the signal is set off (i.e. before the LEDs stop flashing and remain the same color), that's considered a "bad" attempt.

Video 1 Video 2
Video 1 Video 2

Setup

Components

  • Ultrasonic sensor HC-SR04
  • 220 ohm resistors
  • Two RGB LEDs
  • IIC 0.91" OLED Display
  • Some wires
  • Breadboard
  • Arduino Uno r3

Wiring

Wiring

Click image to download fzz file

Code

See code here. All code is implemented as non-blocking, i.e. there are no delay calls.

Main sketch

The main sketch can be found here:

Settings

There is two setting files that may need adjustment:

  • Settings - various settings.
  • Pins layout - the Arduino pins to be setup in accordance with your own wiring.

Display

Code responsible for rendering information on the screen:

Gameplay

The gameplay is driven by the code here:

Lights

The lights management is implemented here:

Sonar

Detecting the player's hand using the sonar is implemented here:

World

Keeping track of the game 'world' is done here:

About

Arduino reaction time game

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages