Project in progress
Pachinko Arrange Ball Restoration

Pachinko Arrange Ball Restoration © LGPL

Trying to revive an older, unique Pachinko whose control board was victim to fire sprinkler (water) damage...

  • 798 views
  • 0 comments
  • 0 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

I'm into all kinds of arcade type machines, and I was gifted this unique Pachinko Arrange Ball and assumed it would be easy to fix and get parts for. I was wrong. Luckily it is a simple enough machine I thought I would try one of these Arduino things to give it some new life. Still a work in progress, but this is my first Sketch and Arduino project. Maybe a little overly ambitious but through some trial and error and some help from the Arduino & Pachitalk community, I've got a good amount of the way in a matter of hours. Well OK, maybe like 12 hours. I do have some background in PLC's but not much computer programming. I still have some logistical hurdles but just a matter of troubleshooting now...

Here I'm checking how the 8 SPDT relay board I bought works. I though I could test this without load right off the Arduino, however I could only get the LED's on the relay board to light up. Apparently I could no source enough power off the Arduino for the relay coils. Once I sourced power for the Relay board from my power supply it worked fine. The built in OPTO couplers keep it safe for the Arduinio. I really only needed 3 Relays to power 3x 110vac Solenoids but there was only about $1 difference And I had plenty of room, now I have some spares...

The original lamp board had tiny incandescent indicators. Because of their age they were varying in intensity and the connection method to make them serviceable was also failing after so many years. So I was getting intermittent light or flickering. My solution was 2-fold. Upgrade to LED, the Arduino could power directly and rethink the way the lights are triggered.

Originally the lamps were just in series with the switches. This would be fine but the conditions of the switches are also not 100% anymore. Also, like my pinball's, I wanted to have a lamp test built into the program. This means I had to wire the LED's separately from the switches. Which in this case was convenient because the switch array was plugged into the lamp board and it has the same pin pitch as the Arduino Headers. I have one LED hanging off the side because that was the widest board I had laying around. I used some ball point pens and cut them in sections to help shield and focus the light. LED's with a series 220ohm resistors are wired directly to the Arduino. I added an output test to the "setup" section to run once when the machine is powered. The output test cycles the lamps in order, as well as "Low Coin" & "Game Over" lights. I thought the "Low Coin" & "Game Over" would be bright enough with a single LED, but I ended up with 3 in each to light up nicely. I also added 2 "Ball Chute" LED's. It's very hard to tell how many balls you have left when you get low, plus I had 2 left over...

The output test also cycles the 3 relays for the coin rejection solenoid, ball release solenoid and payout solenoid. I have the ball release commented out, because I personally don't want it to release all the balls every time I power up. I did however leave the payout solenoid in the test so it ejects 1 coin on power up. So I at least have 1 coin to play when I power up, or cycle power. The coin rejection in my coin mechanism needs some TLC, and I'm not sure the original intent, but I wrote the program so that if the machine was low on coins in the coin storage for payout at the end of game, it would not allow a new game by engaging the rejection solenoid and flashing the low coin light.

Back to the switches and the second fold of folds I mentioned above. The switches all still work, but the weight of the balls and condition of the contacts made them less then 100% reliable. I could have done a simple digitalRead(sw1) of the switch and digitalWrite(led1) to light them up, but this proved to give me still some jittery lights. Instead I ended up assigning a variable ss1 (Switch State 1) to each switch, so if the switch is closed it assigns a value of 1. If the variable == 1 then the corresponding light goes on (19 switches and LED's for the play-field). When a new game is started the variables are reset to = 0, turning the lights back off. This also improved the scoring at the end of the game, because I could use the same variable instead of reading the value of the switch.

I still have some ghosts, but I think they are related to the order of events and maybe some delays needed. I will be editing the code as I go. Currently this is a proof of concept and is working.

I know the code is excessively long & possibly redundant in parts, I would appreciate any creative criticism and suggestions. I jumped in writing it in array's and what I though made sense, had it under 200 lines, but I couldn't get it to work right and just wanted to see it work, so I wrote it out what I'll call long hand...

Update [01/03/2018] I have worked out most of the bugs in my sketch and was able to play, score and payout as I believe the original machine was intended. I think I may be using this as my test bed to further my knowledge of the programming but considering a week ago I never had programmed an Arduino before I'm pretty proud of my self. I also have to credit the examples built into the software and the great documentation and community support.

Code

Pachinko Arrange Ball "Hustler" Game Control BoardArduino
I would call this a Working work in progress, I know this code could be drastically reduced, but my lack of better understanding of the code made me write this line by line. Additionally there are some variables in the declaration that aren't used in this code, but in another version I'm working on.

This game is sometimes called a pinball, but it's more like a slot machine. This is a unique variant of a pachinko called an "arrange ball". You insert a coin and the games release 16 balls into a shooter trough. Using the plunger it shoots a ball around an arc and the balls fall through a series of pins, targets, goals and ultimately into 16 numbered slots or 2 return slots. There is a light matrix in the center and if you get the right arrangement of numbers at the end of the game the machine pays out that number of coins. It basically just a series of switches and LEDs that correspond to each other. The numbered LEDs basically just light up when the ball lands in a slot and rests on a leaf switch. I had this trigger a value of 1 for each switch because the switches are old and I was getting some flickering when I did a straight digitalRead and digitalWrite, that and I needed some variable to use for scoring. After you go through all 16 balls you have to press what I'm calling a payout switch. It triggers a game over Led(s) to light and goes through the scoring and pays accordingly.

A new coin through a coin mechanism triggers a switch and starts a new game, resetting all the lights and variables.

Additionally there is a "low coin" switch on a tube that makes sure there is enough coins to cover at least a maximum payout of 15 coins. If not, a low coin light flashes and coin rejection solenoid engages so a new game cannot be started until the coin storage is back to an acceptable level.

I would love some pointers or suggestions on ways to improve this. there are a few delay()'s in here but none of them seem to have any ill effect on game play.
//Declarations
//Lights
const int led1 = 1;
const int led2 = 2;
const int led3 = 3;
const int led4 = 4;
const int led5 = 5;
const int led6 = 6;
const int led7 = 7;
const int led8 = 8;
const int led9 = 9;
const int led10 = 10;
const int led11 = 11;
const int led12 = 12;
const int led13 = 13;
const int led14 = 14;
const int led15 = 15;
const int led16 = 16;
const int greenLed = 17;
const int redLed = 18;
const int doubleLed = 19;
const int ballChuteLed1 = 20;
const int ballChuteLed2 = 21;
const int gameOverLed1 = 22;
const int lowCoinLed2 = 23;
const int gameOverLed2 = 24;
const int lowCoinLed3 = 25;
const int gameOverLed3 = 26;
const int lowCoinLed1 = 27;
//Solenoids
const int payoutSolenoid = 28;
const int coinRejectSolenoid = 29;
const int ballSolenoid = 30;
// Switchs
const int sw1 = 31;
const int sw2 = 32;
const int sw3 = 33;
const int sw4 = 34;
const int sw5 = 35;
const int sw6 = 36;
const int sw7 = 37;
const int sw8 = 38;
const int sw9 = 39;
const int sw10 = 40;
const int sw11 = 41;
const int sw12 = 42;
const int sw13 = 43;
const int sw14 = 44;
const int sw15 = 45;
const int sw16 = 46;
const int swGreen = 47;
const int swRed = 48;
const int swFull = 49;
const int swDouble = 50;
const int swCoin = 51;
const int swPay = 52;
const int swLow = 53;

int ss1 = 0;
int ps1 = 0;
int sc1 = 0;
int ss2 = 0;
int ps2 = 0;
int sc2 = 0;
int ss3 = 0;
int ps3 = 0;
int sc3 = 0;
int ss4 = 0;
int ps4 = 0;
int sc4 = 0;
int ss5 = 0;
int ps5 = 0;
int sc5 = 0;
int ss6 = 0;
int ps6 = 0;
int sc6 = 0;
int ss7 = 0;
int ps7 = 0;
int sc7 = 0;
int ss8 = 0;
int ps8 = 0;
int sc8 = 0;
int ss9 = 0;
int ps9 = 0;
int sc9 = 0;
int ss10 = 0;
int ps10 = 0;
int sc10 = 0;
int ss11 = 0;
int ps11 = 0;
int sc11 = 0;
int ss12 = 0;
int ps12 = 0;
int sc12 = 0;
int ss13 = 0;
int ps13 = 0;
int sc13 = 0;
int ss14 = 0;
int ps14 = 0;
int sc14 = 0;
int ss15 = 0;
int ps15 = 0;
int sc15 = 0;
int ss16 = 0;
int ps16 = 0;
int sc16 = 0;
int ssGreen = 0;
int psGreen = 0;
int scGreen = 0;
int ssRed = 0;
int psRed = 0;
int scRed = 0;
int ssFull = 0;
int psFull = 0;
int scFull = 0;
int ssDouble = 0;
int psDouble = 0;
int scDouble = 0;
int ssCoin = 0;
int psCoin = 0;
int scCoin = 0;
int ssPay = 0;
int psPay = 0;
int scPay = 0;
int runOnce = 0;


// LED Blink without delay
int ledState = LOW;             // ledState used to set the LED
int ledState2 = LOW;
// Generally, you should use "unsigned long" for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0;        // will store last time LED was updated

// constants won't change:
const long interval = 1000; // interval at which to blink (milliseconds)
const long interval2 = 300;

int newGame = 0;
void setup() {
  // put your setup code here, to run once:

  //OUPUT LIGHTS
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);
  pinMode(led7, OUTPUT);
  pinMode(led8, OUTPUT);
  pinMode(led9, OUTPUT);
  pinMode(led10, OUTPUT);
  pinMode(led11, OUTPUT);
  pinMode(led12, OUTPUT);
  pinMode(led13, OUTPUT);
  pinMode(led14, OUTPUT);
  pinMode(led15, OUTPUT);
  pinMode(led16, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(redLed, OUTPUT);
  pinMode(doubleLed, OUTPUT);
  pinMode(lowCoinLed1, OUTPUT);
  pinMode(gameOverLed1, OUTPUT);
  pinMode(lowCoinLed1, OUTPUT);
  pinMode(gameOverLed2, OUTPUT);
  pinMode(lowCoinLed3, OUTPUT);
  pinMode(gameOverLed3, OUTPUT);
  pinMode(ballChuteLed1, OUTPUT);
  pinMode(ballChuteLed2, OUTPUT);

  // OUPUT RELAYS
  pinMode(payoutSolenoid, OUTPUT);
  pinMode(ballSolenoid, OUTPUT);
  pinMode(coinRejectSolenoid, OUTPUT);

  digitalWrite(ballSolenoid, HIGH);
  digitalWrite(coinRejectSolenoid, HIGH);
  digitalWrite(payoutSolenoid, HIGH);

  //INPUT SWITCHES
  pinMode(sw1, INPUT_PULLUP);
  pinMode(sw2, INPUT_PULLUP);
  pinMode(sw3, INPUT_PULLUP);
  pinMode(sw4, INPUT_PULLUP);
  pinMode(sw5, INPUT_PULLUP);
  pinMode(sw6, INPUT_PULLUP);
  pinMode(sw7, INPUT_PULLUP);
  pinMode(sw8, INPUT_PULLUP);
  pinMode(sw9, INPUT_PULLUP);
  pinMode(sw10, INPUT_PULLUP);
  pinMode(sw11, INPUT_PULLUP);
  pinMode(sw12, INPUT_PULLUP);
  pinMode(sw13, INPUT_PULLUP);
  pinMode(sw14, INPUT_PULLUP);
  pinMode(sw15, INPUT_PULLUP);
  pinMode(sw16, INPUT_PULLUP);
  pinMode(swGreen, INPUT_PULLUP);
  pinMode(swRed, INPUT_PULLUP);
  pinMode(swDouble, INPUT_PULLUP);
  pinMode(swFull, INPUT_PULLUP);
  pinMode(swCoin, INPUT_PULLUP);
  pinMode(swPay, INPUT_PULLUP);
  pinMode(swLow, INPUT_PULLUP);

  // Lamp Test on initial power
  delay(251);
  digitalWrite(led1, HIGH);
  delay(251);
  digitalWrite(led1, LOW);
  delay(251);
  digitalWrite(led2, HIGH);
  delay(251);
  digitalWrite(led2, LOW);
  delay(251);
  digitalWrite(led3, HIGH);
  delay(251);
  digitalWrite(led3, LOW);
  delay(251);
  digitalWrite(led4, HIGH);
  delay(251);
  digitalWrite(led4, LOW);
  delay(251);
  digitalWrite(led5, HIGH);
  delay(251);
  digitalWrite(led5, LOW);
  delay(251);
  digitalWrite(led6, HIGH);
  delay(251);
  digitalWrite(led6, LOW);
  delay(251);
  digitalWrite(led7, HIGH);
  delay(251);
  digitalWrite(led7, LOW);
  delay(251);
  digitalWrite(led8, HIGH);
  delay(251);
  digitalWrite(led8, LOW);
  delay(251);
  digitalWrite(led9, HIGH);
  delay(251);
  digitalWrite(led9, LOW);
  delay(251);
  digitalWrite(led10, HIGH);
  delay(251);
  digitalWrite(led10, LOW);
  delay(251);
  digitalWrite(led11, HIGH);
  delay(251);
  digitalWrite(led11, LOW);
  delay(251);
  digitalWrite(led12, HIGH);
  delay(251);
  digitalWrite(led12, LOW);
  delay(251);
  digitalWrite(led13, HIGH);
  delay(251);
  digitalWrite(led13, LOW);
  delay(251);
  digitalWrite(led14, HIGH);
  delay(251);
  digitalWrite(led14, LOW);
  delay(251);
  digitalWrite(led15, HIGH);
  delay(251);
  digitalWrite(led15, LOW);
  delay(251);
  digitalWrite(led16, HIGH);
  delay(251);
  digitalWrite(led16, LOW);
  delay(251);
  digitalWrite(greenLed, HIGH);
  delay(251);
  digitalWrite(greenLed, LOW);
  delay(251);
  digitalWrite(redLed, HIGH);
  delay(251);
  digitalWrite(redLed, LOW);
  delay(251);
  digitalWrite(doubleLed, HIGH);
  delay(251);
  digitalWrite(doubleLed, LOW);
  delay(251);
  digitalWrite(lowCoinLed1, HIGH);
  delay(251);
  digitalWrite(lowCoinLed1, LOW);
  delay(251);
  digitalWrite(lowCoinLed2, HIGH);
  delay(251);
  digitalWrite(lowCoinLed2, LOW);
  delay(251);
  digitalWrite(lowCoinLed3, HIGH);
  delay(251);
  digitalWrite(lowCoinLed3, LOW);
  delay(251);
  digitalWrite(gameOverLed1, HIGH);
  delay(251);
  digitalWrite(gameOverLed1, LOW);
  delay(251);
  digitalWrite(gameOverLed2, HIGH);
  delay(251);
  digitalWrite(gameOverLed2, LOW);
  delay(251);
  digitalWrite(gameOverLed3, HIGH);
  delay(251);
  digitalWrite(gameOverLed3, LOW);
  delay(251);
  digitalWrite(ballChuteLed1, HIGH);
  delay(251);
  digitalWrite(ballChuteLed1, LOW);
  delay(251);
  digitalWrite(gameOverLed1, HIGH);
  digitalWrite(lowCoinLed1, HIGH);
  digitalWrite(gameOverLed2, HIGH);
  digitalWrite(lowCoinLed2, HIGH);
  digitalWrite(gameOverLed3, HIGH);
  digitalWrite(lowCoinLed3, HIGH);
  delay(351);
  digitalWrite(gameOverLed1, LOW);
  digitalWrite(lowCoinLed1, LOW);
  digitalWrite(gameOverLed2, LOW);
  digitalWrite(lowCoinLed2, LOW);
  digitalWrite(gameOverLed3, LOW);
  digitalWrite(lowCoinLed3, LOW);
  digitalWrite(greenLed, HIGH);
  digitalWrite(led6, HIGH);
  digitalWrite(led2, HIGH);
  digitalWrite(led14, HIGH);
  delay(351);
  digitalWrite(greenLed, LOW);
  digitalWrite(led6, LOW);
  digitalWrite(led2, LOW);
  digitalWrite(led14, LOW);
  digitalWrite(led11, HIGH);
  digitalWrite(led1, HIGH);
  digitalWrite(led15, HIGH);
  digitalWrite(led5, HIGH);
  delay(351);
  digitalWrite(led11, LOW);
  digitalWrite(led1, LOW);
  digitalWrite(led15, LOW);
  digitalWrite(led5, LOW);
  digitalWrite(doubleLed, HIGH);
  digitalWrite(led13, HIGH);
  digitalWrite(led7, HIGH);
  digitalWrite(led3, HIGH);
  digitalWrite(led9, HIGH);
  delay(351);
  digitalWrite(doubleLed, LOW);
  digitalWrite(led13, LOW);
  digitalWrite(led7, LOW);
  digitalWrite(led3, LOW);
  digitalWrite(led9, LOW);
  digitalWrite(led10, HIGH);
  digitalWrite(led4, HIGH);
  digitalWrite(led12, HIGH);
  digitalWrite(led8, HIGH);
  digitalWrite(led16, HIGH);
  digitalWrite(redLed, HIGH);
  delay(351);
  digitalWrite(led10, LOW);
  digitalWrite(led4, LOW);
  digitalWrite(led12, LOW);
  digitalWrite(led8, LOW);
  digitalWrite(led16, LOW);
  digitalWrite(redLed, LOW);
  digitalWrite(ballChuteLed1, HIGH);
  digitalWrite(ballChuteLed2, HIGH);
  delay(351);
  digitalWrite(ballChuteLed1, LOW);
  digitalWrite(ballChuteLed2, LOW);
  // End Lamp Test
  // Solenoid Test
  digitalWrite(coinRejectSolenoid, LOW);
  delay(500);
  digitalWrite(coinRejectSolenoid, HIGH);
  delay(500);
  digitalWrite(payoutSolenoid, LOW);
  delay(500);
  digitalWrite(payoutSolenoid, HIGH);
  delay(500);
  /* uncomment to also test ball release
    digitalWrite(ballReleaseSolenoid, LOW);
    delay(700);
  */
  digitalWrite(ballSolenoid, HIGH);
  // END Solenoid Test
} // END setup

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(ballSolenoid, HIGH);
  digitalWrite(payoutSolenoid, HIGH);

  // LED Blinkers (global)
  unsigned long currentMillis = millis();

  // Check Low Coin Switch
  if (digitalRead(swLow) == HIGH) {
    digitalWrite(lowCoinLed1, LOW);
    digitalWrite(lowCoinLed2, LOW);
    digitalWrite(lowCoinLed3, LOW);
    digitalWrite(coinRejectSolenoid, HIGH);
  }
  if (digitalRead(swLow) == LOW) {
    if (currentMillis - previousMillis >= interval) {
      previousMillis = currentMillis;
      if (ledState == LOW) {
        ledState = HIGH;
      } else {
        ledState = LOW;
      }
      digitalWrite(lowCoinLed1, ledState);
      digitalWrite(lowCoinLed2, ledState);
      digitalWrite(lowCoinLed3, ledState);
      digitalWrite(coinRejectSolenoid, LOW);
    }
  }



  // COUNTERS
  // Check Payout Switch
  ssPay = digitalRead(swPay);
  if (ssPay != psPay) {
    if (ssPay == LOW) {
      scPay = 1;
    }
    delay(50);
  }
  psPay = ssPay;

  // Check Coin Slot Switch
  ssCoin = digitalRead(swCoin);
  if (ssCoin != psCoin) {
    if (ssCoin == LOW) {
      scCoin = 1;
    }
    delay(50);
  }
  psCoin = ssCoin;

  // If New Game Check Switches and Light LEDs
  if (scCoin == 1) {
    digitalWrite(ballSolenoid, LOW);
    delay(500);
    digitalWrite(ballSolenoid, HIGH);
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
    digitalWrite(led5, LOW);
    digitalWrite(led6, LOW);
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW);
    digitalWrite(led9, LOW);
    digitalWrite(led10, LOW);
    digitalWrite(led11, LOW);
    digitalWrite(led12, LOW);
    digitalWrite(led13, LOW);
    digitalWrite(led14, LOW);
    digitalWrite(led15, LOW);
    digitalWrite(led16, LOW);
    digitalWrite(greenLed, LOW);
    digitalWrite(redLed, LOW);
    digitalWrite(doubleLed, LOW);
    newGame = 1;
  }
  scCoin = 0;
  if (newGame == 1) {
    digitalWrite(gameOverLed1, LOW);
    digitalWrite(gameOverLed2, LOW);
    digitalWrite(gameOverLed3, LOW);
    digitalWrite(ballChuteLed1, HIGH);
    digitalWrite(ballChuteLed2, HIGH);

    // Check Full Chance Zone Switch
    ssFull = digitalRead(swFull);
    if (ssFull != psFull) {
      if (ssFull == LOW) {
        scFull = 1;
      }
      delay(50);
    }
    psFull = ssFull;

    // Check Green Zone Switch
    ssGreen = digitalRead(swGreen);
    if (ssGreen != psGreen) {
      if (ssGreen == LOW) {
        scGreen = 1;
      }
      delay(50);
    }
    psGreen = ssGreen;
    if (scGreen == 1 || scFull == 1) {
      if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;
        if (ledState == LOW) {
          ledState = HIGH;
        } else {
          ledState = LOW;
        }
      }
      digitalWrite(greenLed, ledState);
    }

    // Check Red Zone Switch
    ssRed = digitalRead(swRed);
    if (ssRed != psRed) {
      if (ssRed == LOW) {
        scRed = 1;
      }
      delay(50);
    }
    psRed = ssRed;
    if (scRed == 1 || scFull == 1) {
      if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;
        if (ledState == LOW) {
          ledState = HIGH;
        } else {
          ledState = LOW;
        }
      }
      digitalWrite(redLed, ledState);
    }

    // Check Double Up Switch
    ssDouble = digitalRead(swDouble);
    if (ssDouble != psDouble) {
      if (ssDouble == LOW) {
        scDouble = 1;
      }
      delay(50);
    }
    psDouble = ssDouble;
    if (scDouble == 1 || scFull == 1) {
      if (currentMillis - previousMillis >= interval) {
        previousMillis = currentMillis;
        if (ledState == LOW) {
          ledState = HIGH;
        } else {
          ledState = LOW;
        }
      }
      digitalWrite(doubleLed, ledState);
    }

    // Check Number Slot Switch 1
    if (digitalRead(sw1) == LOW) {
      ss1 = 1;
    }
    if (ss1 == 1) {
      digitalWrite(led1, HIGH);
    } else {
      digitalWrite(led1, LOW);
    }

    // Check Number Slot Switch 2
    if (digitalRead(sw2) == LOW) {
      ss2 = 1;
    }
    if (ss2 == 1) {
      digitalWrite(led2, HIGH);
    } else {
      digitalWrite(led2, LOW);
    }

    // Check Number Slot Switch 3
    if (digitalRead(sw3) == LOW) {
      ss3 = 1;
    }
    if (ss3 == 1) {
      digitalWrite(led3, HIGH);
    } else {
      digitalWrite(led3, LOW);
    }

    // Check Number Slot Switch 4
    if (digitalRead(sw4) == LOW) {
      ss4 = 1;
    }
    if (ss4 == 1) {
      digitalWrite(led4, HIGH);
    } else {
      digitalWrite(led4, LOW);
    }

    // Check Number Slot Switch 5
    if (digitalRead(sw5) == LOW) {
      ss5 = 1;
    }
    if (ss5 == 1) {
      digitalWrite(led5, HIGH);
    } else {
      digitalWrite(led5, LOW);
    }

    // Check Number Slot Switch 6
    if (digitalRead(sw6) == LOW) {
      ss6 = 1;
    }
    if (ss6 == 1) {
      digitalWrite(led6, HIGH);
    } else {
      digitalWrite(led6, LOW);
    }

    // Check Number Slot Switch 7
    if (digitalRead(sw7) == LOW) {
      ss7 = 1;
    }
    if (ss7 == 1) {
      digitalWrite(led7, HIGH);
    } else {
      digitalWrite(led7, LOW);
    }

    // Check Number Slot Switch 8
    if (digitalRead(sw8) == LOW) {
      ss8 = 1;
    }
    if (ss8 == 1) {
      digitalWrite(led8, HIGH);
    } else {
      digitalWrite(led8, LOW);
    }

    // Check Number Slot Switch 9
    if (digitalRead(sw9) == LOW) {
      ss9 = 1;
    }
    if (ss9 == 1) {
      digitalWrite(led9, HIGH);
    } else {
      digitalWrite(led9, LOW);
    }

    // Check Number Slot Switch 10
    if (digitalRead(sw10) == LOW) {
      ss10 = 1;
    }
    if (ss10 == 1) {
      digitalWrite(led10, HIGH);
    } else {
      digitalWrite(led10, LOW);
    }

    // Check Number Slot Switch 11
    if (digitalRead(sw11) == LOW) {
      ss11 = 1;
    }
    if (ss11 == 1) {
      digitalWrite(led11, HIGH);
    } else {
      digitalWrite(led11, LOW);
    }

    // Check Number Slot Switch 12
    if (digitalRead(sw12) == LOW) {
      ss12 = 1;
    }
    if (ss12 == 1) {
      digitalWrite(led12, HIGH);
    } else {
      digitalWrite(led12, LOW);
    }

    // Check Number Slot Switch 13
    if (digitalRead(sw13) == LOW) {
      ss13 = 1;
    }
    if (ss13 == 1) {
      digitalWrite(led13, HIGH);
    } else {
      digitalWrite(led13, LOW);
    }

    // Check Number Slot Switch 14
    if (digitalRead(sw14) == LOW) {
      ss14 = 1;
    }
    if (ss14 == 1) {
      digitalWrite(led14, HIGH);
    } else {
      digitalWrite(led14, LOW);
    }

    // Check Number Slot Switch 15
    if (digitalRead(sw15) == LOW) {
      sc15 = 1;
    }
    if (ss15 == 1) {
      digitalWrite(led15, HIGH);
    } else {
      digitalWrite(led15, LOW);
    }

    // Check Number Slot Switch 16
    if (digitalRead(sw16) == LOW) {
      sc16 = 1;
    }
    if (ss16 == 1) {
      digitalWrite(led16, HIGH);
    } else {
      digitalWrite(led16, LOW);
    }

  } //END newGame = 1

  if (newGame == 0) {
    //Reset Everything
    ss1 = 0;
    ps1 = 0;
    sc1 = 0;
    ss2 = 0;
    ps2 = 0;
    sc2 = 0;
    ss3 = 0;
    ps3 = 0;
    sc3 = 0;
    ss4 = 0;
    ps4 = 0;
    sc4 = 0;
    ss5 = 0;
    ps5 = 0;
    sc5 = 0;
    ss6 = 0;
    ps6 = 0;
    sc6 = 0;
    ss7 = 0;
    ps7 = 0;
    sc7 = 0;
    ss8 = 0;
    ps8 = 0;
    sc8 = 0;
    ss9 = 0;
    ps9 = 0;
    sc9 = 0;
    ss10 = 0;
    ps10 = 0;
    sc10 = 0;
    ss11 = 0;
    ps11 = 0;
    sc11 = 0;
    ss12 = 0;
    ps12 = 0;
    sc12 = 0;
    ss13 = 0;
    ps13 = 0;
    sc13 = 0;
    ss14 = 0;
    ps14 = 0;
    sc15 = 0;
    ss16 = 0;
    ps16 = 0;
    sc16 = 0;
    ssGreen = 0;
    psGreen = 0;
    scGreen = 0;
    ssRed = 0;
    psRed = 0;
    scRed = 0;
    ssFull = 0;
    psFull = 0;
    scFull = 0;
    ssDouble = 0;
    psDouble = 0;
    scDouble = 0;
  } //END newGame = 0

  // Payout
  if (scPay == 1) {
    if (newGame == 1) {
      // Scoring
      // Line 1 scoreboard matrix 2,6 & 14 pays 1
      if (ss2 == 1 && ss6 == 1 && ss14 == 1) {
        digitalWrite(payoutSolenoid, LOW);
        delay(500);
        digitalWrite(payoutSolenoid, HIGH);
        delay(500);
      }

      // Line 2 scoreboard matrix 1,5,11 & 15 pays 1
      if (ss1 == 1 && ss5 == 1 && ss11 == 1 && ss15 == 1) {
        digitalWrite(payoutSolenoid, LOW);
        delay(500);
        digitalWrite(payoutSolenoid, HIGH);
        delay(500);
      }

      // Line 3 scoreboard matrix 3,7,9 & 13 pays 2 with double up lit pays double
      if (ss3 == 1 && ss7 == 1 && ss9 == 1 && ss13 == 1) {
        digitalWrite(payoutSolenoid, LOW);
        delay(500);
        digitalWrite(payoutSolenoid, HIGH);
        delay(500);
        digitalWrite(payoutSolenoid, LOW);
        delay(500);
        digitalWrite(payoutSolenoid, HIGH);
        delay(500);
        if (scDouble >= 1) {
          digitalWrite(payoutSolenoid, LOW);
          delay(500);
          digitalWrite(payoutSolenoid, HIGH);
          delay(500);
          digitalWrite(payoutSolenoid, LOW);
          delay(500);
          digitalWrite(payoutSolenoid, HIGH);
          delay(500);
        }
      }

      // Line 4 scoreboard matrix 4,6,8,10 & 12 pays 3 with double up lit pays double
      if (ss4 == 1 && ss16 == 1 && ss8 == 1 && ss10 == 1 && ss12 == 1) {
        digitalWrite(payoutSolenoid, LOW);
        delay(500);
        digitalWrite(payoutSolenoid, HIGH);
        delay(500);
        digitalWrite(payoutSolenoid, LOW);
        delay(500);
        digitalWrite(payoutSolenoid, HIGH);
        delay(500);
        digitalWrite(payoutSolenoid, LOW);
        delay(500);
        digitalWrite(payoutSolenoid, HIGH);
        delay(500);
        if (scDouble >= 1) {
          digitalWrite(payoutSolenoid, LOW);
          delay(500);
          digitalWrite(payoutSolenoid, HIGH);
          delay(500);
          digitalWrite(payoutSolenoid, LOW);
          delay(500);
          digitalWrite(payoutSolenoid, HIGH);
          delay(500);
          digitalWrite(payoutSolenoid, LOW);
          delay(500);
          digitalWrite(payoutSolenoid, HIGH);
          delay(500);
        }
      }

      // green and red zone skill shot scoring
      if (ss1 == 1 && ss6 == 1 && ss11 == 1 && ss15 == 1 && ssGreen == 1) {
        digitalWrite(payoutSolenoid, LOW);
        delay(500);
        digitalWrite(payoutSolenoid, HIGH);
        delay(500);
      }
      if (ss3 == 1 && ss8 == 1 && ss9 == 1 && ss16 == 1 && ssRed == 1) {
        digitalWrite(payoutSolenoid, LOW);
        delay(500);
        digitalWrite(payoutSolenoid, HIGH);
        delay(500);
        digitalWrite(payoutSolenoid, LOW);
        delay(500);
        digitalWrite(payoutSolenoid, HIGH);
        delay(500);
      }
      newGame = 0;
    }
  } //END scPay

  scPay = 0;

  if (scPay == 0 && scCoin == 0 && newGame == 0) {
    if (currentMillis - previousMillis >= interval) {
      previousMillis = currentMillis;
      if (ledState == LOW) {
        ledState = HIGH;
      } else {
        ledState = LOW;
      }
    }
    digitalWrite(gameOverLed1, ledState);
    digitalWrite(gameOverLed2, ledState);
    digitalWrite(gameOverLed3, ledState);
  }






} // END LOOP

Schematics

Pachinko Arrange Ball "Hustler"
Replacing a DOA circuit board in what I believe is a 35+ year old PAchinko Machine. Updated all lamps to LED, added a couple LED's to the ball chute so now you can see how many balls you have left to play. Built a lamp and relay/solenoid test into the initial power-up(setup). All switch use inter pull up (INPUT_PULLUP) using original machine simple leaf switches
pachinkohustler_s36IBMKQ4V.fzz

Comments

Similar projects you might like

Smartphone Controlled Arduino 4WD Robot Car

Project in progress by Andriy Baranov

  • 53,241 views
  • 43 comments
  • 98 respects

Arduino Piano

Project in progress by Teo Zhi Yi

  • 2,681 views
  • 0 comments
  • 7 respects

Make an Enhanced R2-D2 to Be Controlled by an Android App

Project tutorial by Kutluhan Aktar

  • 1,443 views
  • 0 comments
  • 2 respects

SMART CUBE: A New Way to Control Your Home

Project tutorial by Alberto Sartori

  • 13,526 views
  • 7 comments
  • 30 respects

Arduino 4WD RC Car

Project tutorial by Andriy Baranov

  • 13,147 views
  • 3 comments
  • 44 respects
Add projectSign up / Login