Ellen Sun, Swasti Jain, Meagan Lipsman
Have you ever wanted to play a fun handheld version of one of your favorite childhood games? Well you're in luck, because this project implements a Whack-A-Mole style game on a RasberryPi Pico RGB keypad display.
The game functions by randomly lighting up buttons one at a time for varying lengths of time. The user must press the button while it is lit to earn a point. If the user hits a button that is not lit then they loose and the game will end.
- Fluid response
- Track your score
- Reset button at end of game for multiple rounds
The following materials are needed to run the game:
- Rasperry Pi Pico
- Pimoroni Pico RGB Keypad Base
- USB to Micro USB-B cord
- Computer configured to run this program
- Two 20x1 pin style (Male) Header Pins
- LED Display Screen
- Four socket to socket (female to female) jumper cables
- Acquire all of your hardware pieces.
- Solder the header pins to the RasPi Pico with the shorter ends on the side with the bootsell button.
- Insert the Pico pins into the header pin holder already present on the RGB keypad board. Install the board with the bootsell button facing upwards so the button is easily accessible.
- Use the socket to socket jumpers to attach the RBG keypad to the LED display. Connect the 1 pin on the LED display to the VBUS pin on the pico, connect the 2 pin on the LED display to a ground pin on the pico, connect the 3 pin on the LED display to the GP6 pin on the pico, and finally connect the 4 pin on the LED display to the GP 7 pin on the pico.
- Make sure that you have CMake set up so that you can build and run code.
- Create a folder for the project.
- In this folder clone this repository using
$ git clone
and copy and pasting the link given when clicking the green code button and selecting the SSH option
- In the same folder, clone the pico-sdk repository using the below command. This will give us access to all the Pico functions needed to run our repo.
$ git clone -b master https://github.com/raspberrypi/pico-sdk.git
-
Create a .txt file called
pico_sdk_path.txt
, and type out the path to yourpico-sdk
folder on only the first line. This will set environment path variablePICO_SDK_PATH
. -
Go into the
pico-sdk
folder using:
$ cd pico-sdk
- Run the command:
$ git submodule update --init
- Also needed is the Pimoroni RGB Keybad Library which has already been included as a part of this repository.
To build code go into your build folder using:
$ cd build/
Next run CMake to compile and build the executable using the following commands:
$ cmake ..
$ make
To flash code onto the Pico, start by pressing the BOOTSEL
button and holding it down while you plug the USB into your computer. In your File Explorer, you should see a new storage location named RPI-RP2
pop up.
Next, find the main loop executable: pico-whack-a-mole\build\src\main_loop.uf2
. This file is created when you build your code. Drag and drop this file into RPI-RP2
.
You will need to do this everytime when rebuilding or flashing new code.