Photoresistor Whac-A-Mole
Inspiration
Both of us had previously only used Arduino in a medical device prototyping context so we wanted to do a fun nostalgic project.
What it does
We created a "whack-a-mole" type game where the three LEDs are set to blink in random intervals and then the user can hit the corresponding block to cover the photoresistor inside. If the user can change the photoresistor value enough from the baseline within a specified time it counts as a hit and the Wifi connected score display will go up. If the player fails to hit the block after the LED lights up the score will not increase.
How we built it
Design process & Materials Arduino MKR WiFi 1010, 3 LEDs, 3 photoresistors, 6 resistors (220 ohm & 10K ohm), jumper wires, wood (for laser cut blocks)
The LEDs were defined as OUTPUTs in Pins 11,12,13 of the MKR WiFi 1010. They were grounded with 220 ohm resistors. The photoresistors were defined as INPUTs to A1, A2 & A3 completing the circuit with one pin connected to 5V and the other connected to ground through a 10K ohm resistor.
Within the code the LEDs, photoresistors and score counter are initialized. Our void connectWifi() loop connects our MKR Wifi 1010 board to our serial monitor. Our void pause() loop accounts for when a button is pressed and no LED has been lit up. Our displayMole loop decided what LED to turn on. Our whackMole() loop determines if the user hits the right block corresponding to the lit LED by checking for a change in the photoresistor value. It reads the initial photoresistor input and considers a 30% change from this baseline reading as a hit. When this condition is met the score counter updates in the serial monitor.
Challenges we ran into
By incorporating LEDs as the actuators or “moles” and phototransistors as the sensors we were able to detect changes in light to correspond to a player having a fast enough reaction time to cover the phototransistor or “whack” the mole. The scoreboard is updated on the serial monitor through wifi by the MKR WiFi 1010 board.
Accomplishments that we're proud of
We're proud about creating a fun and light hearted game with a very simple circuit and interface.
What we learned
We learned about the advantages and disadvantages to a Wifi connection over bluetooth and how to iterate to create a better user experience.
What's next for BEMAD Whac-A-Mole Nostalgia
We hope anyone interested will come play our came and provide feedback to further improve our design.
Log in or sign up for Devpost to join the conversation.