Cardboard Electronic Pinball

This is my page for the Cardboard Pinball workshop. I'll be adding more documentation including videos, shopping list, and Arduino code.

The scratch code can be found online at the Robot Ambassador Scratch Page. Also my friend made Science Pinball for another example of what you can make.

The Scratch code simply takes the inputs from they keyboard buttons; A, S, D, and F. With each bumper being a different key.

For those in the recent class;
A - Blue - Top Bumper -1 point
S - Green - Second Bumper - 10 points
D - Yellow - First Bumper - 100 points
F - Orange - Behind the flippers - no points, but lose a life

It would probably make sense to change the order of the points. So I'll leave that as an exercise to work on for now. Also having 1 point may not be ideal. Choose your own scoring system and see what is most fun.

This is the pinball decorated with the space them and showing the Scratch game I made for it.

This does use an Arduino Leonardo or compatible. Here is the link I buy from on Aliexpress.
I use 3/4 inch steel bearings. I've bought from amazon from BC Precision Balls. The more you buy the cheaper per bearing. This 25 pack seems good at 55 cents per bearing as of this update.
Or go nuts like I did and order 100 on ebay :-)

Arduino Code
The code has been extremely simplified. If you've done a workshop with me this code is already in your Arduino. Caution: you want to connect your wiring first so the pins aren't reading high accidentally. They will send a lot of keystrokes really quickly. I probably need to add debounce, but I liked the simplicity for showing this and handling debounce using simple delays in Scratch.

Button is really input for the different "switches" on the bumpers or the back.
The metal ball makes the contact like a button would

const int ButtonA = 2;    
const int ButtonB = 3;       
const int ButtonC = 4;
const int ButtonD = 5;

void setup() { // initialize the buttons' inputs:
  pinMode(ButtonA, INPUT);      
  pinMode(ButtonB, INPUT);      
  pinMode(ButtonC, INPUT);      
  pinMode(ButtonD, INPUT);      

void loop() {
  if (digitalRead(ButtonA) == HIGH) {
  if (digitalRead(ButtonB) == HIGH) {
  if (digitalRead(ButtonC) == HIGH) {
  if (digitalRead(ButtonD) == HIGH) {

No comments:

Post a Comment