Components and supplies
IRL540N MOSFET
SparkFun MP3 Player Shield
Arduino Mega 2560
Push Buttons with microswitches
24V/14.6A Power Supply
IIC/I2C 1602 Lcd-display-modul
Project description
Code
Arduino controlled Pinball Machine Code
c_cpp
Allows the Arduino to control the game play of a home made pinball machine. Controls lights, sensors, voltage to coils, scoring, etc.
1#include <Wire.h> 2#include <LiquidCrystal_I2C.h> 3 4#include <SPI.h> 5#include <SdFat.h> 6#include <FreeStack.h> 7//and the MP3 Shield Library 8#include <SFEMP3Shield.h> 9#include <EEPROMex.h> 10#include <Arduino.h> 11 12SdFat sd; 13SFEMP3Shield MP3player; 14 15LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address 16 17 18 19 //Variables 20int Balls = 1; //Number of Balls 21int MaxBalls = 5; //Number of Maxballs 22int Lapscountertemp = 0; //Testing 23int Resetcounter =0; //Reset at Loss of Ball 24long Score = 0; //Total Score 25 26 27int adress = 0; 28long Highscore; 29long Bonus = 0; //Bonus 30int DoubleBonus = 0; 31long DoubleBonuscounter = 0; //Counter for 2xBonus 32int AdvanceBonus = 0; 33int AdvanceBonuscounter = 0; 34int Arrowcounter = 0; 35int Arrowbonus = 0; 36int DoubleBonus_Lit = 0; 37int Milli = 150; //Delay 1 38int MilliRoll = 100; //Delay 2 39int Milli_Bumper = 40; //Delay for Bumpers 40int AZTEC_A = 0; 41int AZTEC_Z = 0; 42int AZTEC_T = 0; 43int AZTEC_E = 0; 44int AZTEC_C = 0; 45int Ball_Bonus = 0; 46int Kickout_Bonus =0; 47int Target_Middle = 0; 48int Target_Points = 0; 49volatile int AttractMode = 0; 50int Attractcounter1 = 0; 51int Attractcounter2 = 0; 52int Attractcounter3 = 0; 53int Attractcounter4 = 0; 54int Attractdelay1 = 800; 55int Attractdelay2 = 400; 56int Startplay_A = 0; 57int Startplay_ACTIVE = 0; 58 59int RolloverLinks_Rechts_int_last =LOW; 60int RolloverMitte_int_last = LOW; 61int Slingshots_Links_Rechts_last = LOW; 62int kickoutreset = 0; 63 64int Target_Z_last= LOW; 65int Target_T_last= LOW; 66int Target_E_last= LOW; 67int Target_C_last= LOW; 68int Target_Middle_last= LOW; 69int Target_Points_last= LOW; 70int Ramp_last= LOW; 71 72int SwitchtopLinks_Rechts_last = LOW; 73int SwitchtopMitte_last = LOW; 74 75int Outlanes_Links_Rechts_last =LOW; 76int Sidelanes_Links_Rechts_last = LOW; 77 78 79//Mosfet Variables 80const long interval = 40; // interval at which to trigger solenoids (milliseconds) 81unsigned long Solenoid_TimeTemp; 82unsigned long Solenoid_FireTime; 83unsigned long previousMillis = 0; 84unsigned long currentMillis = 0; 85int MosfetState = LOW; 86 87int Kickout_Trigger = 0; 88int BumperLinks_Trigger = 0; 89int BumperRechts_Trigger = 0; 90int BumperUnten_Trigger = 0; 91 92//PINS 93//int Startplay = 19; 94int RolloverLinks_Rechts = 22; 95int RolloverMitte = 23; 96 97int Kickout = 24; 98int Bumper_Links = 25; 99int Bumper_Rechts = 26; 100int Bumper_Unten = 27; 101 102int Target_Z = 28; 103int Target_T = 29; 104int Target_E = 30; 105int Target_C = 31; 106int Target_M = 32; 107int Target_P = 33; 108 109int SwitchtopLinks_Rechts = 34; 110int SwitchtopMitte = 35; 111int Release = 36; 112 113 114int Spinner = 37; 115int Ramp = 38; 116int Slingshots_Links_Rechts = 39; 117 118 119int Outlanes_Links_Rechts = 42; 120int Sidelanes_Links_Rechts = 43; 121const int solenoidPin_Kickout = 44; 122const int solenoidPin_BumperLinks = 45; 123const int solenoidPin_BumperRechts = 46; 124 125 126//50,51,52 Display 127const int solenoidPin_Release = 49; 128const int solenoidPin_BumperUnten = 48; 129 130 131//Lights 132 133char Light_A = A0; //x2 134char Light_Z = A1; //x2 135char Light_T = A2; //x2 136char Light_E = A3; //x2 137char Light_C = A4; //x2 138char Light_Ball_Bonus = A5; 139int Light_A_Target = A6; 140int Light_Z_Target = A7; 141int Light_T_Target = A8; 142int Light_E_Target = A9; 143int Light_C_Target = A10; 144int Light_Arrow = A11; 145int Light_Double_Bonus_Lit = A12; //x2 146int Light_Advance_Bonus = A13; //x3 147int Light_Double_Bonus = A14; //x1 148 149int Light__Bonus_1 = 14; 150int Light__Bonus_2 = 15; 151int Light__Bonus_3 = 16; 152int Light__Bonus_4 = 17; 153int Light__Bonus_5 = 41;//18 154int Light__Bonus_6 = 19; 155int Light__Bonus_7 = 40; 156int Light__Bonus_8 = A15; 157int Light__Bonus_9 = 5; 158int Light__Bonus_10 = 47; 159//mp3 shield 2,2,3,6,7,8,9 160 161//-A15 162 163//SOUNDS 164 165//1 Bumper 166//2 Slingshots 167//3 Spinner 168//4 Target 169//5 Kickoutlane 170//6 Ball lost 171//7 Game Over 172 173void setup() { 174 // put your setup code here, to run once: 175 176 177 178 179lcd.begin(16,4); // initialize the lcd for 16 chars 4 lines, turn on backlight 180lcd.clear(); 181lcd.print("Aztec Pinball"); 182 183 184//MP3 185 186sd.begin(SD_SEL, SPI_FULL_SPEED); 187MP3player.begin(); 188// 189 190//Variables 191 192 193 194// Inputs 195 196 pinMode(RolloverLinks_Rechts,INPUT); //Rollover Left and right 197 pinMode(RolloverMitte,INPUT); //Rollover Mid 198 pinMode(Target_Z,INPUT); //Target Z 199 pinMode(Target_T,INPUT); //Target T 200 pinMode(Target_E,INPUT); //Target E 201 pinMode(Target_C,INPUT); //Target C 202 pinMode(Target_M,INPUT); //Target M 203 pinMode(Target_P,INPUT); //Target P 204 205 pinMode(Release,INPUT); //Release 206 pinMode(Kickout,INPUT); //Kickout 207 pinMode(Bumper_Rechts,INPUT); 208 pinMode(Bumper_Links,INPUT); 209 pinMode(Bumper_Unten,INPUT); 210 211pinMode(SwitchtopLinks_Rechts,INPUT); 212pinMode(SwitchtopMitte,INPUT); 213pinMode(Spinner,INPUT); 214pinMode(Ramp,INPUT); 215 216//pinMode(Startplay,INPUT); 217pinMode(Outlanes_Links_Rechts,INPUT); 218pinMode(Sidelanes_Links_Rechts,INPUT); 219 220//Outputs 221pinMode(solenoidPin_Release, OUTPUT); 222pinMode(solenoidPin_Kickout, OUTPUT); 223pinMode(solenoidPin_BumperLinks, OUTPUT); 224pinMode(solenoidPin_BumperRechts, OUTPUT); 225pinMode(solenoidPin_BumperUnten, OUTPUT); 226 227 228pinMode(Light_A, OUTPUT); 229pinMode(Light_Z, OUTPUT); 230pinMode(Light_T, OUTPUT); 231pinMode(Light_E, OUTPUT); 232pinMode(Light_C, OUTPUT); 233pinMode(Light_Ball_Bonus, OUTPUT); 234pinMode(Light_Arrow, OUTPUT); 235 236pinMode(Light_A_Target, OUTPUT); 237pinMode(Light_Z_Target, OUTPUT); 238pinMode(Light_T_Target, OUTPUT); 239pinMode(Light_E_Target, OUTPUT); 240pinMode(Light_C_Target, OUTPUT); 241 242pinMode(Light_Double_Bonus_Lit, OUTPUT); 243pinMode(Light_Double_Bonus, OUTPUT); 244pinMode(Light_Advance_Bonus, OUTPUT); 245 246pinMode(Light__Bonus_1, OUTPUT); 247pinMode(Light__Bonus_2, OUTPUT); 248pinMode(Light__Bonus_3, OUTPUT); 249pinMode(Light__Bonus_4, OUTPUT); 250pinMode(Light__Bonus_5, OUTPUT); 251pinMode(Light__Bonus_6, OUTPUT); 252pinMode(Light__Bonus_7, OUTPUT); 253pinMode(Light__Bonus_8, OUTPUT); 254pinMode(Light__Bonus_9, OUTPUT); 255pinMode(Light__Bonus_10, OUTPUT); 256///////// 257 258digitalWrite(Light_A, LOW); 259digitalWrite(Light_Z, LOW); 260digitalWrite(Light_T, LOW); 261digitalWrite(Light_E, LOW); 262digitalWrite(Light_C, LOW); 263digitalWrite(Light_Ball_Bonus, LOW); 264digitalWrite(Light_Arrow, LOW); 265 266digitalWrite(Light_Double_Bonus_Lit, LOW); 267digitalWrite(Light_Double_Bonus, LOW); 268digitalWrite(Light_Advance_Bonus, LOW); 269 270digitalWrite(Light_A_Target, HIGH); 271digitalWrite(Light_Z_Target, HIGH); 272digitalWrite(Light_T_Target, HIGH); 273digitalWrite(Light_E_Target, HIGH); 274digitalWrite(Light_C_Target, HIGH); 275 276digitalWrite(Light__Bonus_1, LOW); 277digitalWrite(Light__Bonus_2, LOW); 278digitalWrite(Light__Bonus_3, LOW); 279digitalWrite(Light__Bonus_4, LOW); 280digitalWrite(Light__Bonus_5, LOW); 281digitalWrite(Light__Bonus_6, LOW); 282digitalWrite(Light__Bonus_7, LOW); 283digitalWrite(Light__Bonus_8, LOW); 284digitalWrite(Light__Bonus_9, LOW); 285digitalWrite(Light__Bonus_10, LOW); 286 287 288} //END SETUP 289 290//////////////////////////////////////////////////////////////////////////////////////////////////////////MAIN 291void loop() { 292 // put your main code here, to run repeatedly: 293 294 295EIFR = bit (INTF5); 296attachInterrupt(5, interruptstart, RISING); 297 298 299if (AttractMode == 0) { 300 301ATTRACT(); 302 } //END ATTRACT 303 304 305 306if (AttractMode == 1) { 307 308 309if (Startplay_ACTIVE == 0){ 310 311 Startplay_ACTIVE = 1; 312 MP3player.stopTrack(); 313 MP3player.playMP3("009.mp3"); 314 ResetGame(); 315 Kickout_ball(); 316} 317 318unsigned long currentMillis = millis(); //Starting Time 319detectCollision(); //Collision and Switch detection 320control_lights(); //Lights 321check_conditions(); //Checks for Bonuses 322 323//Timed Soneloid Triggers running in Main Loop 324 325 326//MOSFET ! 327 328int difference = currentMillis - previousMillis; 329 330 if ((difference >= interval)and (BumperLinks_Trigger == 1)) { 331 previousMillis = currentMillis; 332 BumperLinks_Trigger = 0; 333 digitalWrite(solenoidPin_BumperLinks, LOW); 334 } 335if ((difference >= interval)and (BumperRechts_Trigger == 1)) { 336 previousMillis = currentMillis; 337 BumperRechts_Trigger = 0; 338 digitalWrite(solenoidPin_BumperRechts, LOW); 339 } 340 if ((difference >= interval)and (BumperUnten_Trigger == 1)) { 341 previousMillis = currentMillis; 342 BumperUnten_Trigger = 0; 343 digitalWrite(solenoidPin_BumperUnten, LOW); 344 } 345 346} 347} 348//////////////////////////////////////////////////////////////////////////////////////////////////////////MAIN ENDE 349void interruptstart(){ // ISR! 350 351 AttractMode = 1; 352 detachInterrupt(5); 353 } 354 355 356void ATTRACT (){ //Bad, lazy code !! 357long Highscore = EEPROM.readLong(adress); 358lcd.clear(); 359lcd.print("Aztec Pinball"); 360lcd.setCursor(0,1); 361lcd.print("Highscore "); 362lcd.print(Highscore); 363 364 365while (AttractMode == 0) { 366 367 368lcd.clear(); 369lcd.print("Aztec Pinball"); 370lcd.setCursor(0,1); 371lcd.print("Highscore "); 372lcd.print(Highscore); 373 374Attractcounter1 = 0; 375Attractcounter2 = 0; 376Attractcounter3 = 0; 377Attractcounter4 = 0; 378AttractMode = 0; 379 380digitalWrite(Light_A_Target, LOW); 381digitalWrite(Light_Z_Target, LOW); 382digitalWrite(Light_T_Target, LOW); 383digitalWrite(Light_E_Target, LOW); 384digitalWrite(Light_C_Target, LOW); 385digitalWrite(Light_A, LOW); 386digitalWrite(Light_Z, LOW); 387digitalWrite(Light_T, LOW); 388digitalWrite(Light_E, LOW); 389digitalWrite(Light_C, LOW); 390digitalWrite(Light_Ball_Bonus, LOW); 391digitalWrite(Light_Arrow, LOW); 392digitalWrite(Light_Double_Bonus_Lit, LOW); 393digitalWrite(Light_Double_Bonus, LOW); 394digitalWrite(Light_Advance_Bonus, LOW); 395digitalWrite(Light__Bonus_1, LOW); 396digitalWrite(Light__Bonus_2, LOW); 397digitalWrite(Light__Bonus_3, LOW); 398digitalWrite(Light__Bonus_4, LOW); 399digitalWrite(Light__Bonus_5, LOW); 400digitalWrite(Light__Bonus_6, LOW); 401digitalWrite(Light__Bonus_7, LOW); 402digitalWrite(Light__Bonus_8, LOW); 403digitalWrite(Light__Bonus_9, LOW); 404digitalWrite(Light__Bonus_10, LOW); 405 406 407 408 409digitalWrite(Light__Bonus_1, HIGH); 410delay(Attractdelay1);if (AttractMode == 1) {break;}; 411digitalWrite(Light__Bonus_2, HIGH); 412delay(Attractdelay1);if (AttractMode == 1) {break;}; 413digitalWrite(Light__Bonus_3, HIGH); 414delay(Attractdelay1);if (AttractMode == 1) {break;}; 415digitalWrite(Light__Bonus_4, HIGH); 416delay(Attractdelay1);if (AttractMode == 1) {break;}; 417digitalWrite(Light__Bonus_5, HIGH); 418delay(Attractdelay1);if (AttractMode == 1) {break;}; 419digitalWrite(Light__Bonus_6, HIGH); 420delay(Attractdelay1);if (AttractMode == 1) {break;}; 421digitalWrite(Light__Bonus_7, HIGH); 422delay(Attractdelay1);if (AttractMode == 1) {break;}; 423digitalWrite(Light__Bonus_8, HIGH); 424delay(Attractdelay1);if (AttractMode == 1) {break;}; 425digitalWrite(Light__Bonus_9, HIGH); 426delay(Attractdelay1);if (AttractMode == 1) {break;}; 427digitalWrite(Light__Bonus_10, HIGH); 428delay(Attractdelay1);if (AttractMode == 1) {break;}; 429while (Attractcounter1 <4){ 430digitalWrite(Light__Bonus_1, LOW); 431digitalWrite(Light__Bonus_2, LOW); 432digitalWrite(Light__Bonus_3, LOW); 433digitalWrite(Light__Bonus_4, LOW); 434digitalWrite(Light__Bonus_5, LOW); 435digitalWrite(Light__Bonus_6, LOW); 436digitalWrite(Light__Bonus_7, LOW); 437digitalWrite(Light__Bonus_8, LOW); 438digitalWrite(Light__Bonus_9, LOW); 439digitalWrite(Light__Bonus_10, LOW); 440delay(Attractdelay2);if (AttractMode == 1) {break;}; 441digitalWrite(Light__Bonus_1, HIGH); 442digitalWrite(Light__Bonus_2, HIGH); 443digitalWrite(Light__Bonus_3, HIGH); 444digitalWrite(Light__Bonus_4, HIGH); 445digitalWrite(Light__Bonus_5, HIGH); 446digitalWrite(Light__Bonus_6, HIGH); 447digitalWrite(Light__Bonus_7, HIGH); 448digitalWrite(Light__Bonus_8, HIGH); 449digitalWrite(Light__Bonus_9, HIGH); 450digitalWrite(Light__Bonus_10, HIGH); 451delay(Attractdelay2);if (AttractMode == 1) {break;}; 452Attractcounter1 +=1; 453} 454 455digitalWrite(Light_A, HIGH); 456digitalWrite(Light_A_Target, HIGH); 457delay(Attractdelay1);if (AttractMode == 1) {break;}; 458digitalWrite(Light_Z, HIGH); 459digitalWrite(Light_Z_Target, HIGH); 460delay(Attractdelay1);if (AttractMode == 1) {break;}; 461digitalWrite(Light_T, HIGH); 462digitalWrite(Light_T_Target, HIGH); 463delay(Attractdelay1);if (AttractMode == 1) {break;}; 464digitalWrite(Light_E, HIGH); 465digitalWrite(Light_E_Target, HIGH); 466delay(Attractdelay1);if (AttractMode == 1) {break;}; 467digitalWrite(Light_C, HIGH); 468digitalWrite(Light_C_Target, HIGH); 469delay(Attractdelay1);if (AttractMode == 1) {break;}; 470 471while (Attractcounter2 <4){ 472digitalWrite(Light_A, LOW); 473digitalWrite(Light_A_Target, LOW); 474digitalWrite(Light_Z, LOW); 475digitalWrite(Light_Z_Target, LOW); 476digitalWrite(Light_T, LOW); 477digitalWrite(Light_T_Target, LOW); 478digitalWrite(Light_E, LOW); 479digitalWrite(Light_E_Target, LOW); 480digitalWrite(Light_C, LOW); 481digitalWrite(Light_C_Target, LOW); 482delay(Attractdelay2);if (AttractMode == 1) {break;}; 483digitalWrite(Light_A, HIGH); 484digitalWrite(Light_A_Target, HIGH); 485digitalWrite(Light_Z, HIGH); 486digitalWrite(Light_Z_Target, HIGH); 487digitalWrite(Light_T, HIGH); 488digitalWrite(Light_T_Target, HIGH); 489digitalWrite(Light_E, HIGH); 490digitalWrite(Light_E_Target, HIGH); 491digitalWrite(Light_C, HIGH); 492digitalWrite(Light_C_Target, HIGH); 493delay(Attractdelay2);if (AttractMode == 1) {break;}; 494Attractcounter2 +=1; 495} 496 497digitalWrite(Light_Ball_Bonus, HIGH); 498delay(Attractdelay1);if (AttractMode == 1) {break;}; 499digitalWrite(Light_Arrow, HIGH); 500delay(Attractdelay1);if (AttractMode == 1) {break;}; 501digitalWrite(Light_Double_Bonus_Lit, HIGH); 502delay(Attractdelay1);if (AttractMode == 1) {break;}; 503digitalWrite(Light_Double_Bonus, HIGH); 504delay(Attractdelay1);if (AttractMode == 1) {break;}; 505digitalWrite(Light_Advance_Bonus, HIGH); 506delay(Attractdelay1);if (AttractMode == 1) {break;}; 507while (Attractcounter3 <4){ 508digitalWrite(Light_Ball_Bonus, LOW); 509digitalWrite(Light_Arrow, LOW); 510digitalWrite(Light_Double_Bonus_Lit, LOW); 511digitalWrite(Light_Double_Bonus, LOW); 512digitalWrite(Light_Advance_Bonus, LOW); 513delay(Attractdelay2);if (AttractMode == 1) {break;}; 514digitalWrite(Light_Ball_Bonus, HIGH); 515digitalWrite(Light_Arrow, HIGH); 516digitalWrite(Light_Double_Bonus_Lit, HIGH); 517digitalWrite(Light_Double_Bonus, HIGH); 518digitalWrite(Light_Advance_Bonus, HIGH); 519delay(Attractdelay2);if (AttractMode == 1) {break;}; 520Attractcounter3 +=1; 521} 522delay(2000);if (AttractMode == 1) {break;}; 523 524digitalWrite(Light__Bonus_1, LOW); 525digitalWrite(Light_Ball_Bonus, LOW); 526delay(Attractdelay1);if (AttractMode == 1) {break;}; 527digitalWrite(Light__Bonus_2, LOW); 528digitalWrite(Light_C, LOW); 529digitalWrite(Light_Z_Target, LOW); 530delay(Attractdelay1);if (AttractMode == 1) {break;}; 531digitalWrite(Light__Bonus_3, LOW); 532delay(Attractdelay1);if (AttractMode == 1) {break;}; 533digitalWrite(Light__Bonus_4, LOW); 534digitalWrite(Light_E, LOW); 535delay(Attractdelay1);if (AttractMode == 1) {break;}; 536digitalWrite(Light_Arrow, LOW); 537digitalWrite(Light__Bonus_5, LOW); 538digitalWrite(Light_T_Target, LOW); 539delay(Attractdelay1);if (AttractMode == 1) {break;}; 540digitalWrite(Light__Bonus_6,LOW); 541digitalWrite(Light_T, LOW); 542delay(Attractdelay1);if (AttractMode == 1) {break;}; 543digitalWrite(Light__Bonus_7, LOW); 544digitalWrite(Light_Advance_Bonus, LOW); 545digitalWrite(Light_E_Target, LOW); 546delay(Attractdelay1);if (AttractMode == 1) {break;}; 547digitalWrite(Light_Double_Bonus_Lit, LOW); 548digitalWrite(Light__Bonus_8, LOW); 549digitalWrite(Light_Z, LOW); 550delay(Attractdelay1);if (AttractMode == 1) {break;}; 551digitalWrite(Light__Bonus_9, LOW); 552digitalWrite(Light_C_Target, LOW); 553digitalWrite(Light_Double_Bonus, LOW); 554delay(Attractdelay1);if (AttractMode == 1) {break;}; 555digitalWrite(Light__Bonus_10, LOW); 556digitalWrite(Light_A, LOW); 557digitalWrite(Light_A_Target, LOW); 558delay(Attractdelay1);if (AttractMode == 1) {break;}; 559 560 561 562} 563} 564 565void check_conditions(){ 566 if ((AZTEC_A ==1) && (AZTEC_Z ==1) && (AZTEC_T ==1) && (AZTEC_E ==1) && (AZTEC_C ==1 && (Resetcounter ==0))){ 567 Ball_Bonus =1; 568 DoubleBonus =1; 569 Resetcounter = 1; 570 } 571 572 if (DoubleBonuscounter >50) { 573 DoubleBonus =1; 574 } 575 576 577 578 if (AdvanceBonuscounter >10) { 579 if (AdvanceBonus == 0) { 580 AdvanceBonus ==1; 581 } 582 else if (AdvanceBonus == 1) { 583 AdvanceBonus ==0; 584 } 585 AdvanceBonuscounter = 0; 586 } 587} 588 589 590void detectCollision(){ 591 592int RolloverLinks_Rechts_int = digitalRead(RolloverLinks_Rechts); //Variable for Rollover Switches 593int RolloverMitte_int = digitalRead(RolloverMitte); //Variable for Rollover Switches 594 595int SwitchtopLinks_Rechts_int = digitalRead(SwitchtopLinks_Rechts); //Variable for Rollover Switches 596int SwitchtopMitte_int = digitalRead(SwitchtopMitte); //Variable for Rollover Switches 597int Ramp_int = digitalRead(Ramp); //Variable for Ramp 598int Spinner_int = digitalRead(Spinner); //Variable for Spinner 599int Outlanes_Links_Rechts_int = digitalRead(Outlanes_Links_Rechts); //Variable for Outlanes Links Rechts 600int Sidelanes_Links_Rechts_int = digitalRead(Sidelanes_Links_Rechts); //Variable for Sidelanes Links Rechts 601int Slingshots_Links_Rechts_int = digitalRead(Slingshots_Links_Rechts); //Variable for Sidelanes Links Rechts 602 603int Target_Z_int = digitalRead(Target_Z); //Variable for Target Z 604int Target_T_int = digitalRead(Target_T); //Variable for Target T 605int Target_E_int = digitalRead(Target_E); //Variable for Target E 606int Target_C_int = digitalRead(Target_C); //Variable for Target C 607int Target_M_int = digitalRead(Target_M); //Variable for Target M 608int Target_P_int = digitalRead(Target_P); //Variable for Target P 609 610//Rollovers Links und Rechts und Mitte 611 612if ((RolloverLinks_Rechts_int == HIGH) && (RolloverLinks_Rechts_int_last == LOW) ){ //Rollover pressed 613 614Score100f(); 615RolloverLinks_Rechts_int_last = HIGH; 616 MP3player.stopTrack(); 617 MP3player.playMP3("001.mp3"); 618} 619 620else if ((RolloverLinks_Rechts_int == LOW) && (RolloverLinks_Rechts_int_last == HIGH) ){ //Rollover released 621 RolloverLinks_Rechts_int_last = LOW; 622delay (MilliRoll); 623} 624 625if ((RolloverMitte_int == HIGH) && (RolloverMitte_int_last == LOW) ){ //Rollover pressed 626 627Bonusf(); 628RolloverMitte_int_last = HIGH; 629 MP3player.stopTrack(); 630MP3player.playMP3("001.mp3"); 631} 632 633else if ((RolloverMitte_int == LOW) && (RolloverMitte_int_last == HIGH) ){ //Rollover released 634 RolloverMitte_int_last = LOW; 635 delay (MilliRoll); 636} 637//Switches Left, right and mid 638 639 640if ((SwitchtopLinks_Rechts_int == HIGH) && (SwitchtopLinks_Rechts_last == LOW) ){ //Rollover pressed 641 642Arrowbonus =0; //deacitvate Spinner Bonus 643 644if (AdvanceBonus == 0) { 645Score1000f(); 646} 647else if (AdvanceBonus == 1) { 648Score1000f(); 649Bonusf(); 650AdvanceBonus = 0; 651} 652 653 654SwitchtopLinks_Rechts_last = HIGH; 655//MP3player.stopTrack(); 656// MP3player.playMP3("001.mp3"); 657} 658 659else if ((SwitchtopLinks_Rechts_int == LOW) && (SwitchtopLinks_Rechts_last == HIGH) ){ //Rollover released 660 SwitchtopLinks_Rechts_last = LOW; 661delay (MilliRoll); 662} 663 664if ((SwitchtopMitte_int == HIGH) && (SwitchtopMitte_last == LOW) ){ //Rollover pressed 665Arrowbonus = 1; //acitvate Spinner Bonus 666AZTEC_Af(); 667SwitchtopMitte_last = HIGH; 668//MP3player.stopTrack(); 669 //MP3player.playMP3("001.mp3"); 670} 671 672else if ((SwitchtopMitte_int == LOW) && (SwitchtopMitte_last == HIGH) ){ //Rollover released 673 SwitchtopMitte_last = LOW; 674delay (MilliRoll); 675} 676 677//Slingshots 678 679if ((Slingshots_Links_Rechts_int == HIGH) && (Slingshots_Links_Rechts_last == LOW) ){ //Rollover pressed 680 681 682Score150f(); 683MP3player.stopTrack(); 684MP3player.playMP3("002.mp3"); 685 DoubleBonuscounter +=1; 686 //lcd.setCursor(4,3); 687 //lcd.print("Slingshots"); 688Slingshots_Links_Rechts_last = HIGH; 689} 690 691else if ((Slingshots_Links_Rechts_int == LOW) && (Slingshots_Links_Rechts_last == HIGH) ){ //Rollover released 692 Slingshots_Links_Rechts_last = LOW; 693delay (MilliRoll); 694} 695 696 697//Outlanes 698 699if ((Outlanes_Links_Rechts_int == HIGH) && (Outlanes_Links_Rechts_last == LOW) ){ //Rollover pressed 700 701Bonusf(); 702Score10000f(); 703 //lcd.setCursor(4,3); 704 //lcd.print("Outlane"); 705Outlanes_Links_Rechts_last = HIGH; 706MP3player.stopTrack(); 707 MP3player.playMP3("001.mp3"); 708} 709 710else if ((Outlanes_Links_Rechts_int == LOW) && (Outlanes_Links_Rechts_last == HIGH) ){ //Rollover released 711 Outlanes_Links_Rechts_last = LOW; 712delay (MilliRoll); 713} 714 715 716//Sidelanes 717 718if ((Sidelanes_Links_Rechts_int == HIGH) && (Sidelanes_Links_Rechts_last == LOW) ){ //Rollover pressed 719 720 721Score5000f(); 722//lcd.setCursor(4,3); 723//lcd.print("Sidelane"); 724Sidelanes_Links_Rechts_last = HIGH; 725MP3player.stopTrack(); 726 MP3player.playMP3("001.mp3"); 727} 728 729else if ((Sidelanes_Links_Rechts_int == LOW) && (Sidelanes_Links_Rechts_last == HIGH) ){ //Rollover released 730 Sidelanes_Links_Rechts_last = LOW; 731delay (MilliRoll); 732} 733 734 735 736 737 738 739//RAMP 740if ((Ramp_int == HIGH) && (Ramp_last == LOW) ){ //RAMP Pressed 741 742Rampf(); 743Ramp_last = HIGH; 744} 745 746else if ((Ramp_int == LOW) && (Ramp_last == HIGH) ){ //Ramp released 747 Ramp_last = LOW; 748delay (MilliRoll); 749} 750 751 752 753// TARGETS 754 755if ((Target_Z_int == HIGH) && (Target_Z_last == LOW) ){ //Target hit 756Target_Z_last = HIGH; 757 758 AZTEC_Z = 1; 759 Score = Score +1000; 760 //lcd.setCursor(4,3); 761 //lcd.print("Z"); 762 MP3player.stopTrack(); 763 MP3player.playMP3("004.mp3"); 764 765delay (MilliRoll); 766} 767 768else if ((Target_Z_int == LOW) && (Target_Z_last == HIGH) ){ //Target released 769 Target_Z_last = LOW; 770 delay (MilliRoll); 771} 772 773if ((Target_T_int == HIGH) && (Target_T_last == LOW) ){ //Target hit 774Target_T_last = HIGH; 775 776 AZTEC_T = 1; 777 Score = Score +1000; 778 //lcd.setCursor(4,3); 779 //lcd.print("T"); 780 MP3player.stopTrack(); 781 MP3player.playMP3("004.mp3"); 782 783delay (MilliRoll); 784} 785 786else if ((Target_T_int == LOW) && (Target_T_last == HIGH) ){ //Target released 787 Target_T_last = LOW; 788 delay (MilliRoll); 789} 790 791if ((Target_E_int == HIGH) && (Target_E_last == LOW) ){ //Target hit 792Target_E_last = HIGH; 793 794 AZTEC_E = 1; 795 Score = Score +1000; 796 //lcd.setCursor(4,3); 797 //lcd.print("E"); 798 MP3player.stopTrack(); 799 MP3player.playMP3("004.mp3"); 800 801delay (MilliRoll); 802} 803 804else if ((Target_E_int == LOW) && (Target_E_last == HIGH) ){ //Target released 805 Target_E_last = LOW; 806delay (MilliRoll); 807} 808 809 810if ((Target_C_int == HIGH) && (Target_C_last == LOW) ){ //Target hit 811Target_C_last = HIGH; 812 813 AZTEC_C = 1; 814 Score = Score +1000; 815 //lcd.setCursor(4,3); 816 //lcd.print("C"); 817 MP3player.stopTrack(); 818 MP3player.playMP3("004.mp3"); 819 820delay (MilliRoll); 821} 822 823else if ((Target_C_int == LOW) && (Target_C_last == HIGH) ){ //Target released 824 Target_C_last = LOW; 825 delay (MilliRoll); 826} 827 828if ((Target_M_int == HIGH) && (Target_Middle_last == LOW) ){ //Target hit 829Target_Middle_last = HIGH; 830 831 Target_Middle = 1; 832 Score = Score +500; 833 if (Ball_Bonus ==1){ 834 MaxBalls +=1; 835 Ball_Bonus = 0; 836 digitalWrite(Light_Ball_Bonus, LOW); 837 } 838 839 MP3player.stopTrack(); 840 MP3player.playMP3("004.mp3"); 841 Bonusf(); 842 843delay (MilliRoll); 844} 845 846else if ((Target_M_int == LOW) && (Target_Middle_last == HIGH) ){ //Target released 847 Target_Middle_last = LOW; 848 delay (MilliRoll); 849} 850 851if ((Target_P_int == HIGH) && (Target_Points_last == LOW) ){ //Target hit 852Target_Points_last = HIGH; 853 854Target_Points += 1; 855//MP3player.stopTrack(); 856//MP3player.playMP3("004.mp3"); 857 858 if (AdvanceBonus == 0) { 859 Score1000f(); 860 } 861 else if (AdvanceBonus == 1) { 862 Score1000f(); 863 Bonusf(); 864 AdvanceBonus =0; 865 } 866 867delay (45); //shorter because of Bumpers 868} 869 870else if ((Target_P_int == LOW) && (Target_Points_last == HIGH) ){ //Target released 871 Target_Points_last = LOW; 872 delay (MilliRoll); 873} 874 875 876//SPINNER 877if ((digitalRead(Spinner) == HIGH) ){ 878 879Spinnerf(); 880 881} 882 883 884 885//Ball Release 886if ((digitalRead(Release) == HIGH) ){ 887Releasef(); 888 889} 890 891//Kickout 892if ((digitalRead(Kickout) == HIGH)&& (kickoutreset ==0) ){ 893kickoutreset = 1; 894Kickoutf(); 895 896} 897 898//Bumpers 899if ((digitalRead(Bumper_Links) == HIGH) ){ 900 901BumperLf(); 902 903} 904if ((digitalRead(Bumper_Rechts) == HIGH) ){ 905 906BumperRf(); 907 908} 909if ((digitalRead(Bumper_Unten) == HIGH) ){ 910 911BumperUf(); 912 913} 914} // ENDE Collision Detection 915 916 917//Lights 918 919void control_lights(){ 920 921if (AZTEC_A ==1){ 922 digitalWrite(Light_A, HIGH); 923 digitalWrite(Light_A_Target, LOW); 924} 925if (AZTEC_Z ==1){ 926 digitalWrite(Light_Z, HIGH); 927 digitalWrite(Light_Z_Target, LOW); 928} 929if (AZTEC_T ==1){ 930 digitalWrite(Light_T, HIGH); 931 digitalWrite(Light_T_Target, LOW); 932} 933if (AZTEC_E ==1){ 934 digitalWrite(Light_E, HIGH); 935 digitalWrite(Light_E_Target, LOW); 936} 937if (AZTEC_C ==1){ 938 digitalWrite(Light_C, HIGH); 939 digitalWrite(Light_C_Target, LOW); 940} 941if (Ball_Bonus ==1){ 942 digitalWrite(Light_Ball_Bonus, HIGH); 943} 944 945if (DoubleBonus == 1){ 946 947 digitalWrite(Light_Double_Bonus, HIGH); 948} 949 950else if (DoubleBonus == 0){ 951 digitalWrite(Light_Double_Bonus, LOW); 952} 953 954//########### 955if (DoubleBonus_Lit ==1){ 956 957 digitalWrite(Light_Double_Bonus_Lit, HIGH); 958} 959 960else if (DoubleBonus_Lit ==0){ 961 digitalWrite(Light_Double_Bonus_Lit, LOW); 962} 963 964//################ 965 966 967 968 969 970if (Arrowbonus ==1){ 971 digitalWrite(Light_Arrow, HIGH); 972 } 973 974else if (Arrowbonus ==0){ 975 digitalWrite(Light_Arrow, LOW); 976 } 977 978 979if (AdvanceBonus == 1) { 980 digitalWrite(Light_Advance_Bonus, HIGH); 981} 982else if (AdvanceBonus == 0) { 983 digitalWrite(Light_Advance_Bonus, LOW); 984} 985 986//Bonus Lights 987//############### 988 989if (Bonus == 5000) { 990 digitalWrite(Light__Bonus_1, HIGH); 991} 992else if (Bonus == 10000) { 993 digitalWrite(Light__Bonus_2, HIGH); 994} 995 996else if (Bonus == 15000) { 997 digitalWrite(Light__Bonus_3, HIGH); 998} 999else if (Bonus == 20000) { 1000 digitalWrite(Light__Bonus_4, HIGH); 1001} 1002else if (Bonus == 25000) { 1003 digitalWrite(Light__Bonus_5, HIGH); 1004} 1005else if (Bonus == 30000) { 1006 digitalWrite(Light__Bonus_6, HIGH); 1007} 1008else if (Bonus == 35000) { 1009 digitalWrite(Light__Bonus_7, HIGH); 1010} 1011else if (Bonus == 40000) { 1012 digitalWrite(Light__Bonus_8, HIGH); 1013} 1014else if (Bonus == 45000) { 1015 digitalWrite(Light__Bonus_9, HIGH); 1016} 1017else if (Bonus == 50000) { 1018 digitalWrite(Light__Bonus_10, HIGH); 1019} 1020 1021//############### 1022} 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033//Scoring 1034 1035 1036 1037void Score100f() 1038{ 1039 Score = Score +100; 1040 AdvanceBonuscounter +=1; 1041 ScoreDisplay(); //Show Score 1042 delay(Milli); 1043} 1044 1045void Score150f() //Slingshots 1046{ 1047 Score = Score +150; 1048 1049 ScoreDisplay(); //Show Score 1050 delay(Milli); 1051} 1052 1053void Score1000f() 1054{ 1055 Score = Score +1000; 1056 AdvanceBonuscounter +=1; 1057 ScoreDisplay(); //Show Score 1058 delay(Milli); 1059} 1060void Score5000f() 1061{ 1062 Score = Score +5000; 1063 AdvanceBonuscounter +=1; 1064 ScoreDisplay(); //Show Score 1065 delay(Milli); 1066} 1067 1068void Score10000f() 1069{ 1070 Score = Score +10000; 1071 1072 ScoreDisplay(); //Show Score 1073 delay(Milli); 1074} 1075 1076void Kickoutscoref(){ 1077 int AZTEC_SUM = (AZTEC_A + AZTEC_Z +AZTEC_T +AZTEC_E +AZTEC_C); 1078 1079 if (DoubleBonus_Lit == 0) { //########## 1080 Score = Score +(5000* AZTEC_SUM); 1081 } 1082 else if (DoubleBonus_Lit == 1) { //########## 1083 Score = Score +(10000* AZTEC_SUM); 1084 DoubleBonus = 1; 1085 } 1086 AdvanceBonuscounter +=1; 1087} 1088 1089 1090 1091void Bonusf() 1092{ 1093 if (Bonus < 50000){ 1094 Bonus = Bonus +5000; 1095 } 1096 ScoreDisplay(); //Show Score 1097 AdvanceBonuscounter +=1; 1098 delay(Milli); 1099} 1100 1101 1102 1103void Spinnerf(){ 1104 1105 MP3player.stopTrack(); 1106 MP3player.playMP3("003.mp3"); 1107 1108 if (Arrowbonus == 0) { 1109 Score = Score +100; 1110 } 1111 else if (Arrowbonus == 1) { 1112 Score = Score +1000; 1113 } 1114 1115 ScoreDisplay(); //Show Score 1116 // lcd.setCursor(4,3); 1117// lcd.print("SPINNER !"); 1118 delay(50); 1119} 1120 1121 1122void AZTEC_Af(){ 1123 //lcd.setCursor(4,3); 1124 //lcd.print("Aztec AF called "); 1125 //lcd.print(AZTEC_A); 1126 AZTEC_A = 1; 1127 Score = Score +1000; 1128 AdvanceBonuscounter +=1; 1129 1130 //lcd.setCursor(4,3); 1131 //lcd.print("A"); 1132 delay(Milli); 1133} 1134 1135void Rampf() { 1136 Bonusf(); 1137 if (DoubleBonus_Lit == 1){ //########## 1138 DoubleBonus = 1; 1139 } 1140 //lcd.setCursor(4,3); 1141 //lcd.print("Ramp"); 1142 delay(Milli); 1143} 1144 1145 1146 1147 1148 1149 1150 1151 1152void BumperLf() 1153{ 1154 Score = Score +200; 1155 DoubleBonuscounter +=1; 1156 ScoreDisplay(); //Show Score 1157 1158 previousMillis = millis(); 1159 digitalWrite(solenoidPin_BumperLinks, HIGH); 1160 BumperLinks_Trigger =1 ; 1161 1162 1163 1164 delay(Milli_Bumper); 1165 1166 1167} 1168void BumperRf() 1169{ 1170 Score = Score +200; 1171 DoubleBonuscounter +=1; 1172 ScoreDisplay(); //Show Score 1173 1174 previousMillis = millis(); 1175 digitalWrite(solenoidPin_BumperRechts, HIGH); 1176 BumperRechts_Trigger =1 ; 1177 1178 1179 1180 delay(Milli_Bumper); 1181 1182} 1183 1184 1185void BumperUf() 1186{ 1187 Score = Score +200; 1188 DoubleBonuscounter +=1; 1189 ScoreDisplay(); //Show Score 1190 1191 previousMillis = millis(); 1192 digitalWrite(solenoidPin_BumperUnten, HIGH); 1193 BumperUnten_Trigger =1 ; 1194 1195 1196 1197 delay(Milli_Bumper); 1198} 1199 1200 1201void Kickoutf() 1202{ 1203 Kickoutscoref(); 1204 1205 ScoreDisplay(); //Show Score 1206 1207 MP3player.stopTrack(); 1208MP3player.playMP3("005.mp3"); 1209 delay(1000); 1210 digitalWrite(solenoidPin_Kickout, HIGH); 1211 1212 delay(Milli); 1213 digitalWrite(solenoidPin_Kickout,LOW); 1214 delay(250); 1215 kickoutreset = 0; 1216} 1217 1218 1219 1220void Releasef() 1221{ 1222 1223 1224 if (Balls <MaxBalls){ 1225 Balls +=1; 1226 1227 lcd.clear(); 1228 lcd.setCursor(4,3); 1229 lcd.print("Ball Lost"); 1230 1231 1232 Ball_Lost(); 1233 1234 } 1235 1236else if (Balls >=MaxBalls){ 1237 lcd.clear(); 1238 lcd.setCursor(4,3); 1239 lcd.print("Game Over"); 1240 Game_Over(); 1241 } 1242} 1243 1244void Kickout_ball() { 1245 1246lcd.setCursor(4,3); 1247lcd.print("Start"); 1248delay(1000); 1249digitalWrite(solenoidPin_Release, HIGH); 1250delay (100); //TEST 1251digitalWrite(solenoidPin_Release,LOW); 1252delay (400); 1253} 1254 1255 1256void ResetGame() { 1257Score = 0; 1258MaxBalls = 5; 1259Bonus = 0; 1260AZTEC_A = 0; 1261AZTEC_Z = 0; 1262AZTEC_T = 0; 1263AZTEC_E = 0; 1264AZTEC_C = 0; 1265Ball_Bonus = 0; 1266Kickout_Bonus =0; 1267DoubleBonus = 0; 1268DoubleBonuscounter = 0; 1269AdvanceBonus = 0; 1270AdvanceBonuscounter = 0; 1271Arrowbonus = 0; 1272RolloverLinks_Rechts_int_last =LOW; 1273RolloverMitte_int_last = LOW; 1274Target_Z_last = LOW; 1275Target_T_last = LOW; 1276Target_E_last = LOW; 1277Target_C_last = LOW; 1278Target_Middle_last= LOW; 1279Target_Points_last= LOW; 1280Ramp_last = LOW; 1281 1282int SwitchtopLinks_Rechts_last = LOW; 1283int SwitchtopMitte_last = LOW; 1284int Outlanes_Links_Rechts_last = LOW; 1285int Sidelanes_Links_Rechts_last = LOW; 1286 1287digitalWrite(Light_A, LOW); 1288digitalWrite(Light_Z, LOW); 1289digitalWrite(Light_T, LOW); 1290digitalWrite(Light_E, LOW); 1291digitalWrite(Light_C, LOW); 1292digitalWrite(Light_Ball_Bonus, LOW); 1293digitalWrite(Light_Arrow, LOW); 1294digitalWrite(Light_Double_Bonus, LOW); 1295digitalWrite(Light_A_Target, HIGH); 1296digitalWrite(Light_Z_Target, HIGH); 1297digitalWrite(Light_T_Target, HIGH); 1298digitalWrite(Light_E_Target, HIGH); 1299digitalWrite(Light_C_Target, HIGH); 1300digitalWrite(Light__Bonus_1, LOW); 1301digitalWrite(Light__Bonus_2, LOW); 1302digitalWrite(Light__Bonus_3, LOW); 1303digitalWrite(Light__Bonus_4, LOW); 1304digitalWrite(Light__Bonus_5, LOW); 1305digitalWrite(Light__Bonus_6, LOW); 1306digitalWrite(Light__Bonus_7, LOW); 1307digitalWrite(Light__Bonus_8, LOW); 1308digitalWrite(Light__Bonus_9, LOW); 1309digitalWrite(Light__Bonus_10, LOW); 1310 1311 ScoreDisplay(); //Show Score 1312 delay (100); 1313 1314} 1315 1316 1317void Ball_Lost() { 1318 1319MP3player.stopTrack(); 1320MP3player.playMP3("006.mp3"); 1321 1322previousMillis = millis(); 1323delay(1000); 1324digitalWrite(solenoidPin_Release, HIGH); 1325delay (100); //TEST 1326digitalWrite(solenoidPin_Release,LOW); 1327 1328 1329if (DoubleBonus == 0) { 1330Score = Score + Bonus; 1331} 1332else if (DoubleBonus == 1) { 1333Score = Score + Bonus + Bonus; 1334} 1335 1336Bonus = 0; 1337AZTEC_A = 0; 1338AZTEC_Z = 0; 1339AZTEC_T = 0; 1340AZTEC_E = 0; 1341AZTEC_C = 0; 1342Ball_Bonus = 0; 1343Kickout_Bonus =0; 1344DoubleBonus = 0; 1345DoubleBonuscounter = 0; 1346Arrowbonus = 0; 1347RolloverLinks_Rechts_int_last =LOW; 1348RolloverMitte_int_last = LOW; 1349Target_Z_last = LOW; 1350Target_T_last = LOW; 1351Target_E_last = LOW; 1352Target_C_last = LOW; 1353Target_Middle_last= LOW; 1354Target_Points_last= LOW; 1355Ramp_last = LOW; 1356 1357int SwitchtopLinks_Rechts_last = LOW; 1358int SwitchtopMitte_last = LOW; 1359int Outlanes_Links_Rechts_last = LOW; 1360int Sidelanes_Links_Rechts_last = LOW; 1361 1362digitalWrite(Light_A, LOW); 1363digitalWrite(Light_Z, LOW); 1364digitalWrite(Light_T, LOW); 1365digitalWrite(Light_E, LOW); 1366digitalWrite(Light_C, LOW); 1367digitalWrite(Light_Ball_Bonus, LOW); 1368digitalWrite(Light_Arrow, LOW); 1369digitalWrite(Light_Double_Bonus, LOW); 1370digitalWrite(Light_A_Target, HIGH); 1371digitalWrite(Light_Z_Target, HIGH); 1372digitalWrite(Light_T_Target, HIGH); 1373digitalWrite(Light_E_Target, HIGH); 1374digitalWrite(Light_C_Target, HIGH); 1375digitalWrite(Light__Bonus_1, LOW); 1376digitalWrite(Light__Bonus_2, LOW); 1377digitalWrite(Light__Bonus_3, LOW); 1378digitalWrite(Light__Bonus_4, LOW); 1379digitalWrite(Light__Bonus_5, LOW); 1380digitalWrite(Light__Bonus_6, LOW); 1381digitalWrite(Light__Bonus_7, LOW); 1382digitalWrite(Light__Bonus_8, LOW); 1383digitalWrite(Light__Bonus_9, LOW); 1384digitalWrite(Light__Bonus_10, LOW); 1385 1386 ScoreDisplay(); //Show Score 1387 delay (100); 1388} 1389 1390 1391void Game_Over(){ 1392AttractMode = 0; 1393MP3player.stopTrack(); 1394MP3player.playMP3("007.mp3"); 1395 1396if (DoubleBonus == 0) { 1397Score = Score + Bonus; 1398} 1399else if (DoubleBonus == 1) { 1400Score = Score + Bonus + Bonus; 1401} 1402 1403 1404if (Score>Highscore){ 1405 Highscore = Score; 1406 EEPROM.writeLong(adress, Highscore); 1407} 1408 1409 ScoreDisplay(); //Show Score 1410 1411delay (3000); 1412DoubleBonus = 0; 1413DoubleBonuscounter = 0; 1414MaxBalls = 5; 1415Balls = 1; 1416Startplay_ACTIVE = 0; 1417AttractMode = 0; 1418Score = 0; 1419delay (1000); 1420ATTRACT(); 1421} 1422 1423 1424 1425 1426 1427 1428 1429 1430void ScoreDisplay() 1431{ 1432 lcd.clear(); // Clear 1433 lcd.print("Score: "); // First line 1434 lcd.print(Score); // First line 1435 // lcd.setCursor(0,1); 1436 // lcd.print("Bonus: "); // Second line 1437 // lcd.print(Bonus); // Second line 1438 lcd.setCursor(4,3); 1439 lcd.print("Ball: "); // Third line 1440 lcd.print(Balls); // Third line 1441} 1442
Downloadable files
MOSFET wiring for solenoid control
MOSFET wiring for solenoid control
MOSFET wiring for solenoid control
MOSFET wiring for solenoid control
Comments
Only logged in users can leave comments