PinBall Table on Arduino © CERN-OHL

Game table created based on our favorite game - Pinball - on the Arduino; the cheapest and most easily manufactured board game.

  • 2,766 views
  • 3 comments
  • 11 respects

Components and supplies

About this project

Step 1

The first thing I made was the wooden housing. Then I decorate the body.

I glued the body of the game table.

Step 2

After that, it was necessary to strengthen the housing wall qualitatively. I used glue, nails and screws.

This action can be done either now or later, but I did it at first. I glued down the right side. I measured the height - it was 13 cm, and the lowest part body - 11 cm. The higher the slope, the more difficult you will run the iron (or another material ball). The body length received 50 cm.

Step 3

Opening holes on the upper platform. I have made but not yet connected the first actuator.

The Circuit

Wiring

The sensors

Schematics

Circuit Schematic
1 b9se9wfk0c

Code

main gameArduino
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C myDisplay(0x27,16,2);

#define greenLED 2
#define yellowLED 3
#define redLED 4
#define sensor1 8
#define sensor2 9
#define sensor3 10
#define sensor4 11
#define sensor5 12
#define sensor6 13

void setup() 
{
  myDisplay.init();
  myDisplay.backlight();
  myDisplay.print("PLAY!");
  delay(2000);
  myDisplay.setCursor(0,0);
  myDisplay.print("        ");
  myDisplay.setCursor(6,0);
  myDisplay.print("GO GO GO");
  delay(2000);
  myDisplay.setCursor(0,0);
  myDisplay.print("        ");
  
  Serial.begin(9600);
  pinMode(sensor1, INPUT);
  pinMode(sensor2, INPUT);
  pinMode(sensor3, INPUT);
  pinMode(sensor4, INPUT);
  pinMode(sensor5, INPUT);
  pinMode(sensor6, INPUT);
  pinMode(greenLED, OUTPUT);
  pinMode(yellowLED, OUTPUT);
  pinMode(redLED, OUTPUT);
 
  digitalWrite(greenLED, LOW);
  digitalWrite(yellowLED, LOW);
  digitalWrite(redLED, LOW);
  
}


int i=0;
void loop() {
  if (digitalRead(sensor1)==HIGH){
    i=i+20;
    myDisplay.clear();
    myDisplay.setCursor(5,0);
    myDisplay.print("+20!");
    digitalWrite(greenLED, HIGH);
    delay(2000);
    digitalWrite(greenLED, LOW);
    myDisplay.clear();
  }
  
  if (digitalRead(sensor2)==HIGH){
    i=i+50; 
    myDisplay.clear();
    myDisplay.setCursor(5,0);
    myDisplay.print("+50!");   
    digitalWrite(greenLED, HIGH);  
    digitalWrite(yellowLED, HIGH);
    delay(2000);
    digitalWrite(greenLED, LOW);
    digitalWrite(yellowLED, LOW);
    myDisplay.clear();
  }
  
  if (digitalRead(sensor3)==HIGH){
    i=i+100;                       
    myDisplay.clear();
    myDisplay.setCursor(5,0);
    myDisplay.print("+100!");       
    digitalWrite(greenLED, HIGH);   
    digitalWrite(yellowLED, HIGH);
    digitalWrite(redLED, HIGH);
    delay(2000);
    digitalWrite(greenLED, LOW);
    digitalWrite(yellowLED, LOW);
    digitalWrite(redLED, LOW);
    myDisplay.clear();
  }
  
  if (digitalRead(sensor4)==HIGH){
    i=i+20;                        
    myDisplay.clear();
    myDisplay.setCursor(5,0);
    myDisplay.print("+20!");       
    digitalWrite(greenLED, HIGH); 
    delay(2000);
    digitalWrite(greenLED, LOW);
    myDisplay.clear();
  }
 
  if (digitalRead(sensor5)==HIGH){
    i=i+50;                        
    myDisplay.clear();
    myDisplay.setCursor(5,0);
    myDisplay.print("+50!");      
    digitalWrite(greenLED, HIGH); 
    digitalWrite(yellowLED, HIGH);
    delay(2000);
    digitalWrite(greenLED, LOW);
    digitalWrite(yellowLED, LOW);
    myDisplay.clear();
  }
 
  if (digitalRead(sensor6)==HIGH){
    i=i+100;                       
    myDisplay.clear();
    myDisplay.setCursor(5,0);
    myDisplay.print("+100!");     
    digitalWrite(greenLED, HIGH); 
    digitalWrite(yellowLED, HIGH);
    digitalWrite(redLED, HIGH);
    delay(2000);
    digitalWrite(greenLED, LOW);
    digitalWrite(yellowLED, LOW);
    digitalWrite(redLED, LOW);
    myDisplay.clear();
  }
  
  if (i>=500){
    myDisplay.clear();
    myDisplay.setCursor(4,0);
    myDisplay.print("YOU WIN!");
    for (int j=0; j<=15; j=j+1){   
      digitalWrite(greenLED, HIGH);
      digitalWrite(yellowLED, HIGH);
      digitalWrite(redLED, HIGH);
      delay(100);
      digitalWrite(greenLED, LOW);
      digitalWrite(yellowLED, LOW);
      digitalWrite(redLED, LOW);
      delay(100);
    }
    i=0;                           
    myDisplay.clear();
    myDisplay.setCursor(0,0);
    myDisplay.print("New Game");    
    delay(2000);
    myDisplay.setCursor(0,0);
    myDisplay.print("        ");
    myDisplay.setCursor(6,0);
    myDisplay.print("GO!");
    delay(2000);
    myDisplay.setCursor(0,0);
    myDisplay.print("        ");
  }
  
  myDisplay.setCursor(0,0);        
  myDisplay.print("Your Score:");
  myDisplay.setCursor(0,1);
  myDisplay.print(i,DEC);  
}
  
    
for servoArduino
#include <Servo.h>

#define servopin 5
Servo myservo; 

void setup()
{
  myservo.attach(servopin);
  myservo.write(90);
  
}


void loop() {
  myservo.write(160);
  delay(1000);
  myservo.write(30);
  delay(1000);
  }

Comments

Similar projects you might like

IoT Based Garden Automation And Monitoring System

Project tutorial by SURESH V S

  • 324 views
  • 1 comment
  • 9 respects

URB (Universal Railway Model Bus) - Automate Your Layout

Project in progress by Steve_Massikker

  • 76 views
  • 0 comments
  • 2 respects

Punch Activated Arm Flamethrowers (Real Firebending)

Project showcase by Allen Pan

  • 42,563 views
  • 41 comments
  • 324 respects

Visual Capturing with OV7670 on Arduino

by Techduino

  • 4,725 views
  • 14 comments
  • 24 respects

Smart Energy Monitor Based on Arduino

Project tutorial by Mohamed Maher

  • 394 views
  • 1 comment
  • 3 respects
Add projectSign up / Login