Are you one of those people who will reach out to catch a ball a full minute after it's hit your face? If so, then we have good news for you! Using React! anyone can watch their reaction times improve exponentially while having fun competing against their friends.
How to Play:To begin the game, simply plug the external USB cable into a power source such as a laptop or a portable charger. Once powered, the game begins with the sound of a distinctive buzzer noise. As soon as the buzzer sounds, the two players are tasked with hitting their button (touching the moisture sensor on their side of the board) before the other person. Whoever hits it first will have one point added to the score on their side of the four-digit display, and the LED on their side of the board will light up red. After this happens, the buzzer will wait a randomized time and then sound again. If a player hits their button before the buzzer sounds, they will earn a point for their opponent. The scores will count up to 99, so the players can determine whether they want to set an external scoreboard or play to a certain number of points. When players wish to end the game, they can either unplug the power source or press the reset button to reset the scores and begin a new game.
Hardware and Housing:React! uses four modules from the Grove Starter kit including two moisture sensors, a Piezo buzzer, and a 4-digit display. Other circuit components used include two RGB LEDs, two 100 Ohm resistors, a push button, jumper wires, a UBB cable, and a breadboard. The only circuitry involved was the connection of the RGB LEDs. Voltages were supplied from two separate pins of the microprocessor to each of the red anodes, and they were connected to a common ground through a 100 Ohm resistor.
For the housing, a wooden box was laser cut to contain all of the components. On the back of the box, a single circular hole was cut to extend the USB power cable through. On the top of the box, holes were measured and cut for the reset button, LEDs, 4-digit display, and moisture sensors.
Code Explanation:The code for React! accomplished four basic things: timing the buzzer, making a tone, incrementing points (for the winner of a round or as a penalty), and resetting the game. To make all of the hardware components work together, we had to design a system of states to handle a variety of events. There was essentially a single loop that ran very quickly and checked numerous booleans and integer counters to dictate what events would take place in the next iteration. While the timer for the buzzer is going down, in each iteration of the loop, the moisture sensors are checked to ensure the threshold is not surpassed (indicating a player is touching their buzzer early). Whenever a score changes, a helper function is called to display the new scores. Finally, whenever the reset button is pressed, scores are reset and the game starts anew.
We designed this code using a system of states to account for problems that arose with scoring the game. For example, we could not make use of the DELAY command for the buzzer because the tone was long enough for both players to touch their moisture sensors, resulting in erroneous scoring. To fix this, we initially thought to use interrupts. However, interrupts generally only work with digital input, and the moisture sensor only takes in analog input. To solve this problem, we structured our program around thirteen boolean variables that collectively represent the state of the game. The main loop then uses sensor input and past data to determine which states the game should transition into. The advantage to this system is that multiple independent sensors can be controlled simultaneously, as every sensor is read and responded to every time the loop runs. This eliminates the need for interrupts and enables our program to handle the increased complexity of our game with a simple loop.
Improvements in Future Models:We have plans to improve our game in the future:
- Portability
One thing we wanted to do was improve the ability of the game to travel well by reducing the volume of the box and condensing the internal elements to reduce shifting and make it easier to hold and carry.
- Better buttons
The moisture sensors sometimes disadvantage those who have drier hands, and they require contact with both prongs. We hope to switch to large press buttons in a future model.
- Indicator for the Penalty Point
Currently, there is no indication for when a penalty point is earned. In the next model, we will add a light indicator in the form of the LED lighting up blue when a point is earned due to a penalty on the other player.
- Single-Player Mode
In the future, we hope to be able to switch between a multiplayer mode and a single-player version where a person simply competes against his or herself to see how fast they can press the button. The 4-digit display would then simply show the time between the buzzer sound and the button press.
Comments
Please log in or sign up to comment.