/*
  Button
  Turns on and off a light emitting diode(LED) connected to digital pin 13,
  when pressing a pushbutton attached to pin 2.
  The circuit:
  - LED attached from pin 13 to ground
  - pushbutton attached to pin 2 from +5V
  - 10K resistor attached to pin 2 from ground
  - Note: on most Arduinos there is already an LED on the board
    attached to pin 13.
  created 2005
  by DojoDave <http://www.0j0.org>
  modified 30 Aug 2011
  by Tom Igoe
  This example code is in the public domain.
  http://www.arduino.cc/en/Tutorial/Button
*/
// constants won't change. They're used here to set pin numbers:
const int buttonPin1 = 31;     // the number of the pushbutton pin
const int buttonPin2 = 32;
const int buttonPin3 = 33;
const int buttonPin4 = 34;
const int buttonPin5 = 35;
const int buttonPin6 = 36;     // the number of the pushbutton pin
const int buttonPin7 = 37;
const int buttonPin8 = 38;
const int buttonPin9 = 39;
const int buttonPin10 = 40;
const int buttonPin11= 41;     // the number of the pushbutton pin
const int buttonPin12= 42;
const int buttonPin13 = 43;
const int buttonPin14 = 44;
const int buttonPin15 = 45;
const int buttonPin16 = 46;     // the number of the pushbutton pin
const int buttonPin17= 47;
const int buttonPin18= 48;
const int buttonPin19= 49;
const int buttonPin20= 50;
const int buttonPin21= 51;     // the number of the pushbutton pin
const int buttonPin22= 52;
const int buttonPin23= A1;
const int buttonPin24= A2;
const int buttonPin25 = A3;
const int buttonPin26= A4;     // the number of the pushbutton pin
const int buttonPin27= A5;
const int buttonPin28 = A6;
const int buttonPin29 = A7;
const int buttonPin30 = A8;
const int ledPin =  A15;  
const int ledPin1 =  1;      // the number of the LED pin
const int ledPin2 =  2;
const int ledPin3 =  3;
const int ledPin4 =  4;
const int ledPin5 =  5;
const int ledPin6 =  6;      // the number of the LED pin
const int ledPin7 =  7;
const int ledPin8 =  8;
const int ledPin9 =  9;
const int ledPin10 = 10;
const int ledPin11 = 11;      // the number of the LED pin
const int ledPin12=  12;
const int ledPin13=  13;
const int ledPin14=  14;
const int ledPin15=  15;
const int ledPin16 = 16;      // the number of the LED pin
const int ledPin17=  17;
const int ledPin18=  18;
const int ledPin19=  19;
const int ledPin20=  20;
const int ledPin21=  21;      // the number of the LED pin
const int ledPin22=  22;
const int ledPin23=  23;
const int ledPin24 =  24;
const int ledPin25 = 25;
const int ledPin26 = 26;      // the number of the LED pin
const int ledPin27=  27;
const int ledPin28=  28;
const int ledPin29=  29;
const int ledPin30=  30;
// variables will change:
int buttonState1 = 0;         // variable for reading the pushbutton status
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
int buttonState6 = 0;         // variable for reading the pushbutton status
int buttonState7 = 0;
int buttonState8 = 0;
int buttonState9 = 0;
int buttonState10= 0;
int buttonState11= 0;         // variable for reading the pushbutton status
int buttonState12= 0;
int buttonState13= 0;
int buttonState14= 0;
int buttonState15= 0;
int buttonState16 = 0;         // variable for reading the pushbutton status
int buttonState17 = 0;
int buttonState18 = 0;
int buttonState19 = 0;
int buttonState20 = 0;
int buttonState21= 0;         // variable for reading the pushbutton status
int buttonState22= 0;
int buttonState23= 0;
int buttonState24= 0;
int buttonState25= 0;
int buttonState26= 0;         // variable for reading the pushbutton status
int buttonState27= 0;
int buttonState28= 0;
int buttonState29= 0;
int buttonState30= 0;
void setup() {
  // initialize the LED pin as an output:
  // initialize the pushbutton pin as an input:
  pinMode(ledPin, OUTPUT); 
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);
  pinMode(ledPin5, OUTPUT); 
  pinMode(ledPin6, OUTPUT);
  pinMode(ledPin7, OUTPUT);
  pinMode(ledPin8, OUTPUT);
  pinMode(ledPin9, OUTPUT);
  pinMode(ledPin10, OUTPUT); 
  pinMode(ledPin11, OUTPUT);
  pinMode(ledPin12, OUTPUT);
  pinMode(ledPin13, OUTPUT);
  pinMode(ledPin14, OUTPUT);
  pinMode(ledPin15, OUTPUT);
   pinMode(ledPin, OUTPUT); 
  pinMode(ledPin16, OUTPUT);
  pinMode(ledPin17, OUTPUT);
  pinMode(ledPin18, OUTPUT);
  pinMode(ledPin19, OUTPUT);
  pinMode(ledPin20, OUTPUT); 
  pinMode(ledPin21, OUTPUT);
  pinMode(ledPin22, OUTPUT);
  pinMode(ledPin23, OUTPUT);
  pinMode(ledPin24, OUTPUT);
  pinMode(ledPin25, OUTPUT); 
  pinMode(ledPin26, OUTPUT);
  pinMode(ledPin27, OUTPUT);
  pinMode(ledPin28, OUTPUT);
  pinMode(ledPin29, OUTPUT);
  pinMode(ledPin30, OUTPUT);
  pinMode(buttonPin1, INPUT_PULLUP);
  pinMode(buttonPin2, INPUT_PULLUP);
  pinMode(buttonPin3, INPUT_PULLUP);
  pinMode(buttonPin4, INPUT_PULLUP);
  pinMode(buttonPin5, INPUT_PULLUP);
  pinMode(buttonPin6, INPUT_PULLUP);
  pinMode(buttonPin7, INPUT_PULLUP);
  pinMode(buttonPin8, INPUT_PULLUP);
  pinMode(buttonPin9, INPUT_PULLUP);
  pinMode(buttonPin10, INPUT_PULLUP);
  pinMode(buttonPin11, INPUT_PULLUP);
  pinMode(buttonPin12, INPUT_PULLUP);
  pinMode(buttonPin13, INPUT_PULLUP);
  pinMode(buttonPin14, INPUT_PULLUP);
  pinMode(buttonPin15, INPUT_PULLUP);
  pinMode(buttonPin16, INPUT_PULLUP);
  pinMode(buttonPin17, INPUT_PULLUP);
  pinMode(buttonPin18, INPUT_PULLUP);
  pinMode(buttonPin19, INPUT_PULLUP);
  pinMode(buttonPin20, INPUT_PULLUP);
  pinMode(buttonPin21, INPUT_PULLUP);
  pinMode(buttonPin22, INPUT_PULLUP);
  pinMode(buttonPin23, INPUT_PULLUP);
  pinMode(buttonPin24, INPUT_PULLUP);
  pinMode(buttonPin25, INPUT_PULLUP);
  pinMode(buttonPin26, INPUT_PULLUP);
  pinMode(buttonPin27, INPUT_PULLUP);
  pinMode(buttonPin28, INPUT_PULLUP);
  pinMode(buttonPin29, INPUT_PULLUP);
  pinMode(buttonPin30, INPUT_PULLUP);
  digitalWrite(ledPin1, LOW);// turn LED off:
  digitalWrite(ledPin2, LOW);// turn LED off:
  digitalWrite(ledPin3, LOW);// turn LED off:
  digitalWrite(ledPin4, LOW);// turn LED off:
  digitalWrite(ledPin5, LOW);// turn LED off:
  digitalWrite(ledPin6, LOW);// turn LED off:
  digitalWrite(ledPin7, LOW);// turn LED off:
  digitalWrite(ledPin8, LOW);// turn LED off:
  digitalWrite(ledPin9, LOW);// turn LED off:
  digitalWrite(ledPin10, LOW);// turn LED off:
  digitalWrite(ledPin11, LOW);// turn LED off:
  digitalWrite(ledPin12, LOW);// turn LED off:
  digitalWrite(ledPin13, LOW);// turn LED off:
  digitalWrite(ledPin14, LOW);// turn LED off:
  digitalWrite(ledPin15, LOW);// turn LED off:
  digitalWrite(ledPin16, LOW);// turn LED off:
  digitalWrite(ledPin17, LOW);// turn LED off:
  digitalWrite(ledPin18, LOW);// turn LED off:
  digitalWrite(ledPin19, LOW);// turn LED off:
  digitalWrite(ledPin20, LOW);// turn LED off:
  digitalWrite(ledPin21, LOW);// turn LED off:
  digitalWrite(ledPin22, LOW);// turn LED off:
  digitalWrite(ledPin23, LOW);// turn LED off:
  digitalWrite(ledPin24, LOW);// turn LED off:
  digitalWrite(ledPin25, LOW);// turn LED off:
  digitalWrite(ledPin26, LOW);// turn LED off:
  digitalWrite(ledPin27, LOW);// turn LED off:
  digitalWrite(ledPin28, LOW);// turn LED off:
  digitalWrite(ledPin29, LOW);// turn LED off:
  digitalWrite(ledPin30, LOW);// turn LED off:
}
void loop() {
  // read the state of the pushbutton value:
  buttonState1 = digitalRead(buttonPin1);
  buttonState2 = digitalRead(buttonPin2);
  buttonState3 = digitalRead(buttonPin3);
  buttonState4 = digitalRead(buttonPin4);
  buttonState5 = digitalRead(buttonPin5);
  buttonState6 = digitalRead(buttonPin6);
  buttonState7 = digitalRead(buttonPin7);
  buttonState8 = digitalRead(buttonPin8);
  buttonState9 = digitalRead(buttonPin9);
  buttonState10 = digitalRead(buttonPin10);
  buttonState11 = digitalRead(buttonPin11);
  buttonState12 = digitalRead(buttonPin12);
  buttonState13 = digitalRead(buttonPin13);
  buttonState14 = digitalRead(buttonPin14);
  buttonState15 = digitalRead(buttonPin15);
  buttonState16 = digitalRead(buttonPin16);
  buttonState17 = digitalRead(buttonPin17);
  buttonState18 = digitalRead(buttonPin18);
  buttonState19 = digitalRead(buttonPin19);
  buttonState20 = digitalRead(buttonPin20);
  buttonState21 = digitalRead(buttonPin21);
  buttonState22 = digitalRead(buttonPin22);
  buttonState23 = digitalRead(buttonPin23);
  buttonState24 = digitalRead(buttonPin24);
  buttonState25 = digitalRead(buttonPin25);
  buttonState26 = digitalRead(buttonPin26);
  buttonState27 = digitalRead(buttonPin27);
  buttonState28 = digitalRead(buttonPin28);
  buttonState29 = digitalRead(buttonPin29);
  buttonState30 = digitalRead(buttonPin30);
  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState1 == HIGH) {
    
    digitalWrite(ledPin1, HIGH);// turn LED on:
  } 
  if (buttonState2 == HIGH) {
    
    digitalWrite(ledPin2, HIGH);// turn LED on:
  } 
   if (buttonState3 == HIGH) {
    
    digitalWrite(ledPin3, HIGH);// turn LED on:
  }
  if (buttonState4 == HIGH ) {
    
    digitalWrite(ledPin4, HIGH);// turn LED on:
  } 
  if (buttonState5 == HIGH) {
    
    digitalWrite(ledPin5, HIGH);// turn LED on:
  } 
  if (buttonState6 == HIGH) {
    
    digitalWrite(ledPin6, HIGH);// turn LED on:
  } 
   if (buttonState7 == HIGH) {
    
    digitalWrite(ledPin7, HIGH);// turn LED on:
  }
  if (buttonState8 == HIGH ) {
    
    digitalWrite(ledPin8, HIGH);// turn LED on:
  } 
  if (buttonState9 == HIGH) {
    
    digitalWrite(ledPin9, HIGH);// turn LED on:
  } 
  if (buttonState10 == HIGH) {
    
    digitalWrite(ledPin10, HIGH);// turn LED on:
  } 
   if (buttonState11 == HIGH) {
    
    digitalWrite(ledPin11, HIGH);// turn LED on:
  }
  if (buttonState12 == HIGH ) {
    
    digitalWrite(ledPin12, HIGH);// turn LED on:
  } 
  if (buttonState13 == HIGH ) {
    
    digitalWrite(ledPin13, HIGH);// turn LED on:
  } 
  if (buttonState14 == HIGH ) {
    
    digitalWrite(ledPin14, HIGH);// turn LED on:
  } 
  if (buttonState15 == HIGH ) {
    
    digitalWrite(ledPin15, HIGH);// turn LED on:
  } 
 if (buttonState1 == HIGH ||buttonState2 == HIGH || buttonState3 == HIGH|| buttonState4 == HIGH || buttonState5 == HIGH || buttonState6 == HIGH ||buttonState7 == HIGH || buttonState8 == HIGH|| buttonState9 == HIGH || buttonState10 == HIGH||buttonState11 == HIGH ||buttonState12 == HIGH || buttonState13 == HIGH|| buttonState14 == HIGH || buttonState15 == HIGH)
   {
    digitalWrite(ledPin, HIGH);// turn LED on:
  } 
 if (buttonState16 == HIGH) {
    
    digitalWrite(ledPin16, HIGH);// turn LED on:
  }
 
   if (buttonState17 == HIGH) {
    
    digitalWrite(ledPin17, HIGH);// turn LED on:
  }
  if (buttonState18 == HIGH ) {
    
    digitalWrite(ledPin18, HIGH);// turn LED on:
  } 
  if (buttonState19 == HIGH) {
    
    digitalWrite(ledPin19, HIGH);// turn LED on:
  } 
  if (buttonState20 == HIGH) {
    
    digitalWrite(ledPin20, HIGH);// turn LED on:
  } 
   if (buttonState21 == HIGH) {
    
    digitalWrite(ledPin21, HIGH);// turn LED on:
  }
   if (buttonState22 == HIGH) {
    
    digitalWrite(ledPin22, HIGH);// turn LED on:
  }
  if (buttonState23 == HIGH ) {
    
    digitalWrite(ledPin23, HIGH);// turn LED on:
  } 
  if (buttonState24 == HIGH) {
    
    digitalWrite(ledPin24, HIGH);// turn LED on:
  } 
  if (buttonState25 == HIGH) {
    
    digitalWrite(ledPin25, HIGH);// turn LED on:
  } 
   if (buttonState26 == HIGH) {
    
    digitalWrite(ledPin26, HIGH);// turn LED on:
  }
  if (buttonState27 == HIGH ) {
    
    digitalWrite(ledPin27, HIGH);// turn LED on:
  } 
  if (buttonState28 == HIGH ) {
    
    digitalWrite(ledPin28, HIGH);// turn LED on:
  } 
  if (buttonState29 == HIGH ) {
    
    digitalWrite(ledPin29, HIGH);// turn LED on:
  } 
  if (buttonState30 == HIGH ) {
    
    digitalWrite(ledPin30, HIGH);// turn LED on:
  } 
 if (buttonState16 == HIGH ||buttonState17 == HIGH || buttonState18 == HIGH|| buttonState19 == HIGH || buttonState20 == HIGH || buttonState21 == HIGH ||buttonState22 == HIGH || buttonState23 == HIGH|| buttonState24 == HIGH || buttonState25 == HIGH||buttonState26 == HIGH ||buttonState27 == HIGH || buttonState28 == HIGH|| buttonState29 == HIGH || buttonState30 == HIGH)
   { digitalWrite(ledPin, HIGH);// turn LED on:
  } 
}