bradsprojects has been created and maintained by me - Brad!

 

Reaction

Reaction is quite a simple little game whereby you have to press a push button as quick as you can when the LED changes from RED to GREEN. The faster your reaction time the lower the number that will be displayed on the seven segment display.

 
 

All the credit for this idea came from DJSPANKY one of the resident forum members. Thanks very much for the idea!

As stated above, the game is all about your reaction time. The Bi-colour LED will start out RED. It will then change to GREEN after a 'seemingly' random amount of time has passed (anywhere upto about 10 seconds). As soon as it turns to GREEN, that is the time to REACT! and you need to press the push button. The seven segment display will then show you your score (anywhere between 0 and 9) 0 is the fastest reaction time with 9 being the slowest.

 
 

Parts list

 
 
1 x PIC 16f628a or 16f648a
1 x Common anode seven segment display
1 x bi-colour LED
9 x 150 ohm resistors
1 x 10k resistor
some hookup wire
1 x momentary push-button
1 x breadboard or someway of connecting the circuit
PIC programmer
 

The schematic

You can download the fullsize schematic here

 
 

You can download the sourcecode here

If you have a look through the sourcecode, you may notice that it is not the most efficient way to write a game like this. I sort of just started out with making the LED's do their thing and then it just flowed from there. Nevertheless it only uses about 220 bytes of program memory so it's not like were going to run out of storage space!

 
 

You can check out the video clip of this game on youtube by clicking here

 
 

Some things for you to try

 
 
Give it some more animations - or better animations to make the game a little more interesting?
Make it so the game has levels. I.E. level 1 would be very simple and have a slow clock speed. Then you would increase the speed from there as you advanced in levels.
Make more combinations of random numbers (I.E. I think I allowed for maybe 10 different loop timings from red to green)
Maybe make it into a two player game? Two push buttons, two seven segment displays and one bi-colour LED. The first person to press their button when the LED changes get's one point. The first to nine points wins.