Skip to content
This repository has been archived by the owner on Aug 21, 2022. It is now read-only.

Latest commit

 

History

History
88 lines (70 loc) · 7.35 KB

English.md

File metadata and controls

88 lines (70 loc) · 7.35 KB

Index

The game

Bop It! Pi is a game made for the Raspberry Pi, built on the Processing Programming Language and that makes use of the board's General Purpose Input and Output (GPIO) pins. It was inspired by Bop It! Smash, a toy made by Hasbro.

How to play it

The game consists on trying to get the greatest score you can without losing your lives on doing it. The LEDs will flash like a ball bouncing from side to side. You need to press two keys on your keyboard or press both of the connected push buttons to catch it. The yellow and red LEDs make you lose a heart, while the blue LED (the one in the center) recovers one. The score you get for each catch also depends on the color of the LED where the "ball" stops on. Ideas for a new game mechanic? Questions? You can report them to me here!

What you will need:

  • A Raspberry Pi of any model (the one shown in the tutorial will be the Raspberry Pi Model 2 v1.1);
  • A double-sided breadboard*;
  • 2 red LEDs**;
  • 2 yellow LEDs**;
  • 2 green LEDs**;
  • 1 blue LED**;
  • 7 330ohm resistors;
  • 11 male to female jumper wires (3 of them are optional);
  • 9 male to male jumper wires (2 of them are optional);
  • The Processing code available here;
  • 2 push buttons (optional).

* You can manage to build the circuit on a single-sided breadboard as well, but the explanation will be based on a double-sided one.
** The LEDs don't need to necessarily be red, green, yellow and blue. The only thing that matters is wether not you arrange them properly. You can also edit the code to add more LEDs to the project, remove some of them if the ones you have aren't enough or maybe even edit their conections with the GPIO interface.

How to build it:

Circuit images made with Fritzing. You can click them to see them in full screen or you can see all of the tutorial files here.

1. Be sure your Raspberry Pi is working, turn it off and grab your breadboard. Explanatory image for step 1
2. Simetrically place the LEDs on the bottom side of your breadboard with their anode legs (the short ones) to the right. Explanatory image for step 2
3. Using a male to female jumper wire, make a connection between any ground pin on your Raspberry Pi and the negative (blue) column on your breadboard. Explanatory image for step 3
4. Use male to male wires to connect the anode legs (the ones on the right) of the LEDs to the negative column of the breadboard. Explanatory image for step 4
6. Use all of the 7 resistors to connect the cathode legs (the ones on the left) of the LEDs to any hole on the line on top of the one where your LED cathode is connected to on your breadboard. Explanatory image for step 5
5. On the same lines, connect the resistors to your Raspberry Pi in the following order (go from the extreme left resistor to the extreme right one):
  • GPIO17 (pin 11)
  • GPIO18 (pin 12)
  • GPIO27 (pin 13)
  • GPIO22 (pin 15)
  • GPIO23 (pin 16)
  • GPIO24 (pin 18)
  • GPIO25 (pin 22)
Explanatory image for step 6
7. Once you have the Processing code on your computer, make sure you've installed Processing for Pi and run the files for the game itself. Alternatively, if you don't want to edit the code anytime soon, you can run the exported application available here without needing to install Processing itself. Processing for Pi download page
8. It's done! Congratulations, you did it! I hope you enjoy it a lot! Feel free to make a question and to help me develop this project even more! If you need help playing the game, check out the how to play section! Image of a physically built circuit

Placing the buttons (optional)

If you want to, you can use push buttons instead of keys to play the game. Below is a tutorial showing you how to put them on your circuit.

1. Grab your circuit and turn off your Raspberry Pi Explanatory image for step 1
2. Simetrically place the buttons on your breadboard. Make sure they cross the frontier between the sides of your board. Explanatory image for step 2
3. Using a male to female jumper wire, make a connection between any 5V pin on your Raspberry Pi and the positive (red) column of your breadboard. Explanatory image for step 3
4. Connect one of the legs of each button with the positive column of your breadboard using male to male jumper wires. Explanatory image for step 4
5. Connect the remaining leg of each button to the Raspberry Pi on the respective pins:
  • GPIO4 (pin 7)
  • GPIO5 (pin 29)
Explanatory image for step 5
6. It's done! Now you can play Bop-It-Pi using either the keys on your keyboard or the push buttons you've just placed! Image of a physically built circuit (with buttons)