Friday, 31 October 2014 17:56

Arduino Powered Pinball Machine

Ah Halloween has passed but does that mean i have to stop playing my Elvira themed digital pinball machine.
A real Makers dream this was cobbled together using one 15″ screen and one 23″ HD screen. Powered using a low form factor motherboard, super fast graphics card and lots of memory.
software is XP running visual pinball withloads of tables installed
Sound from the internals of some speakers that were lting around the workshop
Custom built cabinet with 5 buttons and a wooden plunger.

But then came the difficulty how to control all the buttons, normally for this an IPAC or equivalent is used but not wanting to spend any more it was down to whats lying around the workshop!.
Luckily there was an Arduino Leonardo sitting around connected to a few leds not doing much. A quick search on the net and a few rewrites to get rid of button bounce and we now had our first Leonardo controlled pinball machine.
Great Fun and now up for sale as i need the room to build the next project!

Heres the code:
int timer = 500;
int timer2= 100;
int previousButtonState = LOW;
int previousButtonState3 = LOW;
int previousButtonState4 = LOW;
int previousButtonState5 = LOW;
int previousButtonState6 = LOW;
int previousButtonState7 = LOW;
void setup() {
// make pin 2 an input and turn on the
// pullup resistor so it goes high unless
// connected to ground:
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);

void loop() {
//if the button is pressed
int buttonState = digitalRead(2);
if((buttonState != previousButtonState) && (buttonState ==LOW)){
//Send an ASCII ’1′,;
previousButtonState = buttonState;
int buttonState3 = digitalRead(3);
if((buttonState3 != previousButtonState3) && (buttonState3 ==LOW)){
//Send an ASCII ’5′,
previousButtonState3 = buttonState3;
int buttonState4 = digitalRead(4);
if((buttonState4 != previousButtonState4) && (buttonState4 ==LOW)){
//Send an ASCII ’9 replace esc’,
previousButtonState4 = buttonState4;
int buttonState5 = digitalRead(5);
if((buttonState5 != previousButtonState4) && (buttonState5 ==LOW)){
//Send an ASCII ’0′ replace enter,;
while (digitalRead(5) == LOW) {
// do nothing until pin 2 goes low
previousButtonState5 = buttonState5;
int buttonState6 = digitalRead(6);
if((buttonState6 != previousButtonState6) && (buttonState6 ==LOW)){
//Send an ASCII ‘z’,;
previousButtonState6 = buttonState6;
int buttonState7 = digitalRead(7);
if((buttonState7 != previousButtonState7) && (buttonState7 ==LOW)){
//Send an ASCII ‘?’,;
previousButtonState7 = buttonState7;

Published in Arduino
Back to Top