Go Down

Topic: arduino pinball-like (Read 944 times) previous topic - next topic

antonis14

For a strange reason it is working  :)
The rules:
each red target is 1p.,yellow 2p.,when all these are hitten it is given one right save which activates
the right fan when the ball passes over a fotocell (the black dot under the right bridge)
at 60,80,...,200p. and for  5p. it is getting down the white cup where at its end there is the blue
target which when it is hitten it is given one left save which activates the left fan when both
racket bottons are pressed.
at 30p.,100p. it is falling a ball from the left bridge.
at 205p. it is getting down the ramp and when the target it is hitten it is playing the song
"celebration" and the servo throws the pistache  :)
I am a begginer and  thanks of Arduino  i had a very nice time making it and now playing :)

Feedback

Nice, never thought of such a solution

odometer

I think that the "ball launcher" is clever.

How do you start the game? Where are the controls?
Please make a video, if you can.

antonis14

The controls are 2 push-buttons on the breadboard and a 3rd for the start.
I am sorry for the quality of the video...
https://youtu.be/MvbPlnG-GH8

prince_x2


antonis14

New edition  :)         

https://www.youtube.com/watch?v=Ogodwb-IaQ4


odometer

New edition  :)         

https://www.youtube.com/watch?v=Ogodwb-IaQ4
The video is very low resolution. It's hard to see what's happening.

Budvar10

Pretty nice approach to construction, like from the scrap heap. :)
+1
Arduino clone with ATmega1284P

racemaniac

awesome project XD.
making low budget pinballs like this should become a thing XD

charliesixpack

These are made in my local maker space.  More info here.


antonis14

Final edition :)
Arduino mega is now full:
30 leds
11 vibration sensors
6 servos
2 motors
1 vibration motor
4 photocells
2 solenoids
3 relays
speaker
screen
4 push buttons
The funniest moment with this game is when sometimes the upper left racket hits the ball back
so fast that is impossible to react,the ball passes the hole, the border (i will make a special ramp
for this..) and hits right into the face :)

racemaniac

#11
Mar 21, 2016, 05:07 pm Last Edit: Mar 21, 2016, 05:08 pm by racemaniac
I took some inspiration from these projects, and tried to make a pinball at the arduino jam in belgium last weekend: Arduino jam pinball

functionaldesign

racemaniac;
I'm trying to make something similar to the targets I see you have in the cardboard pinball machine. Do you share how you have made this somewhere? I didn't find details on the Arduino Jam webpage. The arduino code would be greatly appreciated!

racemaniac

racemaniac;
I'm trying to make something similar to the targets I see you have in the cardboard pinball machine. Do you share how you have made this somewhere? I didn't find details on the Arduino Jam webpage. The arduino code would be greatly appreciated!
For detecting the ball hitting them, i use some piezo discs Piezo discs. The link i gave here are with wires presoldered, you can get them a lot cheaper without the wires, and it's not that hard to solder :).

The electronics of the target are very simple:

The negative side is connected to the ground, the positive side to an analog pin of the arduino, and a 10k resistor across it as pull down resistor.
For the led matching the target, you just connect it as you would connect any led to the arduino :). choose a pin, put an appropriate resistor between the led & the arduino, and that's it :). (so the led and the target are on seperate pins)

And the code i have for reading the targets & setting the leds (small note: my leds were wired such that putting the pin LOW lights them them, putting it HIGH dims them):
Code: [Select]
/*
 * pinball v0.1
 */

#define numBalls 3

#define targetCount 4
#define targetLed1 8
#define targetLed2 9
#define targetLed3 10
#define targetLed4 11

#define targetPin1 A0
#define targetPin2 A1
#define targetPin3 A2
#define targetPin4 A3

typedef struct target
{
  byte detectPin;
  byte ledPin;
  byte hit;
};

uint16_t score;

target targets[targetCount] = {{targetPin1,targetLed1, 0}
                    ,{targetPin2,targetLed2, 0}
                    ,{targetPin3,targetLed3, 0}
                    ,{targetPin4,targetLed4, 0}
};


// the setup function runs once when you press reset or power the board
void setup() {
  pinMode(targetLed1, OUTPUT);
  pinMode(targetLed2, OUTPUT);
  pinMode(targetLed3, OUTPUT);
  pinMode(targetLed4, OUTPUT);
  pinMode(targetPin1, INPUT);
  pinMode(targetPin2, INPUT);
  pinMode(targetPin3, INPUT);
  pinMode(targetPin4, INPUT);
}

// the loop function runs over and over again forever
void loop()
{
  detectCollision();
  redrawTargets();
  checkAllTargets();
}

void detectCollision()
{
  int a = analogRead(targets[0].detectPin);
  int b = analogRead(targets[1].detectPin);
  int c = analogRead(targets[2].detectPin);
  int d = analogRead(targets[3].detectPin);

  if(a>100 || b>100 || c>100 || d>100)
  {
    if(a >b && a>c && a>d)
      targets[0].hit = 1;
    else if(b>c && b>d)
      targets[1].hit = 1;
    else if(c>d)
      targets[2].hit = 1;
    else
      targets[3].hit = 1;
    score += 50;
    delay(100);
  }
}

void redrawTargets()
{
  for(int i = 0; i < targetCount; i++)
    digitalWrite(targets[i].ledPin, 1-targets[i].hit);
 
}

void dimTargets()
{
  for(int i = 0; i < targetCount; i++)
    digitalWrite(targets[i].ledPin, HIGH);
 
}

void checkAllTargets()
{
  for(int i = 0; i < targetCount; i++)
    if(targets[i].hit == 0)
      return;
  score += 200;
  for(int i = 0; i < targetCount; i++)
    targets[i].hit = 0;
  blinkTargets();
}

void blinkTargets()
{
    for(int i = 0; i < 5; i++)
  {
    redrawTargets();
    delay(200);
    dimTargets();
    delay(200);
  }
  redrawTargets();
}

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy