Arduino Arcade


Have students build a simple arcade-style game using Arduino, breadboard, resistors, LEDs, buttons, sensors, and any other electronics materials available. Students should code some program to help keep score or determine the game's winner. Students can build games such as Whack-a-Mole, copy cat memory games, rapid button push race games, and others. 

Authors: Rose Solow and Orian Sneor

Whack-a-Mole and Copy Cat

We built Arduino Whack-a-Mole using LED lights as "moles" that turn on and off. The player needs to hit the correct button depending on which LED is on to score points. Two circuit designs were built on the breadboard, one for the LED circuit and one for the button circuit. The Arduino was coded to randomly turn on the LEDs and to add a point to the score every time the correct corresponding button was pushed. 

We also build Copy Cat using the same circuit design as Whack-a-Mole. Copy Cat was a memory game where the three LEDs would light up in a random pattern and the player would have to push the corresponding buttons in the correct pattern to gain points. Whenever the player got the pattern correct the next light up pattern would include another character (for example if you got a pattern with three digits correct the next time the LEDs would light up the pattern would have four digits.)

Big Idea

 Through this project students will learn:

  • Basic coding skills
  • How to set up simple circuits
  • Knowledge of electronics components
  • Boolean logic

We wanted to incorporate coding with Arduino into the high school students knowledge base. Basic coding is easy to learn and is a very powerful tool. Coding teaches students math skills, reasoning, and logic. We also wanted students to build their own circuits and learn how to use electronics components. We wanted to give the students the opportunity to build something themselves rather than rebuilding a set design. Having the students build an arcade game adds an element of fun and pushes students to be creative. 

Key questions:

What arcade game should I design?
How am I going to code it?
How am I going to build the circuitry?
What electronics will I need?

The Code
whackamole_56980771b2dd5Whack a Mole.pdfapplication/pdf26.25 KB
whack_a_mole_5698077c210ffwhack_a_mole.ino1.76 KB
copycat_56990f72b26bdcopycat.pdfapplication/pdf27.51 KB
copy_cat_56990f7f4f30bcopy_cat.ino2.50 KB
Copy Cat

While coding the two programs bugs inevitably appeared. The number one way I dealt with figuring out what and where a problem was was printing certain variables to the serial monitor to observe their values and how they changed at each iteration. If I couldn't figure something out I would generally just Google the problem. The official Arduino site is very helpful at providing definitions and examples. In addition, Arduino is a very common platform and if you can't find the solution to the problem on the Arduino site I can assure you there is a forum elsewhere on the internet that will answer your question. 

Some common bugs I ran into during my programming:

The Arduino delay() function is extremely useful for slowing down your code, giving a user time to put in inputs, and having certain sections run for set times. If you put in delay(x) at any point in your code the program with pause for x milliseconds before moving on to the next line. Another function that can be used for similar purposes is millis(). I didn't use millis() in my code, but millis() returns the number of milliseconds since your program began running.

Arduino has a built in function to generate random numbers, random(). The function outputs long though and I needed integers. The way I handled this problem was using Arduino's round() function wich rounds the number passed to it to the closest integer value. 

When pushing a button the analog in pins can often misread a single push as multiple pushes. This is a common issue when using buttons as inputs and the solution to the problem is known as debouncing. The way I dealt with the issue is I simply put in a delay after the analog pin read in a value greater then 900. Arduino has a good example of debouncing here. (Arduino's debouncing tutorial is much more complex than my solution to the problem.)
Something that tripped me up on both programs was remembering to turn the LEDs off after I had them turn on. For both programs there were times while I was testing the code that multiple LEDs would be turned on at a time. If you want an LED to be on for a set time set its pin to high, delay, and then set its pin to low.


This project is starter level for Arduino coders, but is by no means an introduction to coding. Students should already be able to know how to create if statements, loops, use analog input, and send outputs to pins. The wires used for this project were too long and stiffer breadboard wires should be used in stead. The long wires make the project a mess and can make the system look too intimidating for builders. This project does not necessarily fit into the set curriculum for high school, but through the process of building their games students will use math skills, apply knowledge of circuitry, and learn how to code their own program. More creativity for game ideas would be encouraged by the addition of LED matrices or digital displays to the circuitry.

Leave a Reply