Reaction Challenge (Will Knowlton and Graham Widmann)

For this project we tried to create a game to test the speed of the players against each other. we unfortunately were not able to complete the whole game but we have all the components to make it work.

The game would be built on box with two buttons (one for each player). We had planned for the lights to switch from one light to another using the 5 LEDs we had. The lights would go in a line back and forth down and up the line for a random time between 1 and 5 seconds. From there the lights would stop and immediately one LED would come on. Then the first player to hit their button first would be the winner of that round. To signify that one of the players won the light closest to them would flash rapidly for  a few seconds. Another tap of the button would cause the flashing to stop and one more tap would reset the LEDs to start the back and forth process again for another random time between 1 and 5 seconds.

To do all this a very complicated state machine would be built with 6 states. One for each LED during the back and forth process and an off state. From this we could our state machine and other functions. The back and forth process would be created using the timer with millis and the switching of states by telling it that once it reached 0.05seconds it would go to the next LED and turn on its light. By using a randomizer for the time a random LED would be selected and displayed for each other players. The buttons would then become “active” and the players could react to the lights. A timer for each player would be started once the led randomizer figured out which LED was selected and the back and forth process had ended.  We would use the debouncer rose function to accomplish the button press and  it would be stored as either a 1 or 0 for the push down or up abilities. By checking each button to see which timer ended faster, we could select the winner. Based on the collected information, either LED1 or LED 5 would begin flashing using another timer to keep track of times for the flashing LED. The button press would tell it which LED to begin flashing because of a created function designated to tell which player won.

We believe that this sort of formula would create a very fun and fast game based purely on reactions to lights.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s