ARDUINO MEGA 2560 ARDUINO MEGA 2560 J.L.G.C | Page 62

programacion

bool willTheBallGoTowardsPlayerTwo = true;

bool isInputAllowed = true;

const int playerOne = 12;

const int goalPlayerOne = 13;

const int buttonPlayerOne = 3;

const int playerTwo = 5;

const int goalPlayerTwo = 4;

const int buttonPlayerTwo = 2;

int scoreOfPlayerOne = 0;

int scoreOfPlayerTwo = 0;

const unsigned long initialMillisecondsPerLED = 500;

const unsigned long initialDeltaMillisecondsPerLED = 50;

unsigned long millisecondsPerLED = initialMillisecondsPerLED;

unsigned long deltaMillisecondsPerLED = initialDeltaMillisecondsPerLED;

unsigned long currentMillis = 0;

unsigned long previousMillis = 0;

int currentPosition = playerOne; //Player one starts the game.

int previousPosition = playerOne + 1;

int deltaPosition = 0;

//int A1=0;

int buttonStatePlayerOne = 0;

int lastButtonStatePlayerOne = 0;

int buttonStatePlayerTwo = 0;

int lastButtonStatePlayerTwo = 0;

int A = 22; //DISPLAY 1

int B = 23;

int C = 24;

int D = 25;

int E = 26;

int F = 27;

int G = 28;

int display1 = 29; //DISPLAY 2

int display2 = 30;

int display3= 31;

int display4 = 32;

int display5 = 33;

int display6 = 34;

int display7 = 35;

int AD1 = 36; //DISPLAY DE NIVEL

int BD2 = 37;

int CD3 = 38;

int DE4 = 39;

int ED5 = 40;

int FD6 = 41;

int GD7 = 42;

void setup() {

pinMode(4, 1);

pinMode(5, 1);

pinMode(6, 1);

pinMode(7, 1);

pinMode(8, 1);

pinMode(9, 1);

pinMode(10, 1);

pinMode(11, 1);

pinMode(12, 1);

pinMode(13, 1);

pinMode (A, OUTPUT);

pinMode (B, OUTPUT);

pinMode (C, OUTPUT);

pinMode (D, OUTPUT);

pinMode (E, OUTPUT);

pinMode (F, OUTPUT);

pinMode (G, OUTPUT);

pinMode (display1, OUTPUT);

pinMode (display2, OUTPUT);

pinMode (display3, OUTPUT);

pinMode (display4, OUTPUT);

pinMode (display5, OUTPUT);

pinMode (display6, OUTPUT);

pinMode (display7, OUTPUT);

59