// 10 key switch board


     // the number of the pushbutton pin
const int switchsetA = A0;
const int switchset1 = A1;
const int switchA = 2;
const int switchB = 3;
const int switchC = 4;
const int switchD = 5;
const int switchE = 6;
const int switch1 = 7;
const int switch2 = 8;
const int switch3 = 9;
const int switch4 = 10;
const int switch5 = 11;
const int speaker = 12;
int speak = 0;
int speek = 0;
int setA = 0;
int set1 = 0;
int readsetA = 0;
int readset1 = 0;
// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  Serial.begin(9600);
  pinMode(speaker, OUTPUT);      
  // initialize the pushbutton pin as an input:
  pinMode(switchA, OUTPUT);
  pinMode(switchB, OUTPUT);   
  pinMode(switchC, OUTPUT);   
  pinMode(switchD, OUTPUT);   
  pinMode(switchE, OUTPUT);   
  pinMode(switch1, OUTPUT);   
  pinMode(switch2, OUTPUT);   
  pinMode(switch3, OUTPUT);   
  pinMode(switch4, OUTPUT);   
  pinMode(switch5, OUTPUT);     
}

void loop(){
  // read the state of the pushbutton value:
 readsetA = analogRead(switchsetA);
 readset1 = analogRead(switchset1); 
 Serial.println(readset1);
 //Serial.println(readsetA);
 if(readset1 <500)
  {
   digitalWrite(switch1, LOW); 
   digitalWrite(switch2, LOW); 
   digitalWrite(switch3, LOW); 
   digitalWrite(switch4, LOW); 
   digitalWrite(switch5, LOW); 
   set1 = 0; 
  }
  if(readset1 > 500)
  {
   if(readset1 < 600)
   {
    digitalWrite(switch1, HIGH); 
    digitalWrite(switch2, LOW); 
    digitalWrite(switch3, LOW); 
    digitalWrite(switch4, LOW); 
    digitalWrite(switch5, LOW);  
    set1 = 1;    
   }
   if(readset1 > 600)
   {
    if(readset1 < 700)
    {
     digitalWrite(switch1, HIGH); 
     digitalWrite(switch2, HIGH); 
     digitalWrite(switch3, LOW); 
     digitalWrite(switch4, LOW); 
     digitalWrite(switch5, LOW);  
     set1 = 2;    
    }
    if(readset1 > 700)
    {
     if(readset1 < 800)
     {
      digitalWrite(switch1, HIGH); 
      digitalWrite(switch2, HIGH); 
      digitalWrite(switch3, HIGH); 
      digitalWrite(switch4, LOW); 
      digitalWrite(switch5, LOW);
      set1 = 3;      
     }
     if(readset1 > 800)
     {
      if(readset1 < 840)
      {
       digitalWrite(switch1, HIGH); 
       digitalWrite(switch2, HIGH); 
       digitalWrite(switch3, HIGH); 
       digitalWrite(switch4, HIGH); 
       digitalWrite(switch5, LOW); 
       set1 = 4;     
      }
      if(readset1 > 840)
      {
       digitalWrite(switch1, HIGH); 
       digitalWrite(switch2, HIGH); 
       digitalWrite(switch3, HIGH); 
       digitalWrite(switch4, HIGH); 
       digitalWrite(switch5, HIGH); 
       set1 =5;     
    }
    }
   }
   }  
  } 
    if(readsetA <500)
  {
   digitalWrite(switchA, LOW); 
   digitalWrite(switchB, LOW); 
   digitalWrite(switchC, LOW); 
   digitalWrite(switchD, LOW); 
   digitalWrite(switchE, LOW); 
   setA = 0; 
  }
  if(readsetA > 500)
  {
   if(readsetA < 600)
   {
    digitalWrite(switchA, HIGH); 
    digitalWrite(switchB, LOW); 
    digitalWrite(switchC, LOW); 
    digitalWrite(switchD, LOW); 
    digitalWrite(switchE, LOW);  
    setA = 1;    
   }
   if(readsetA > 600)
   {
    if(readsetA < 700)
    {
     digitalWrite(switchA, HIGH); 
     digitalWrite(switchB, HIGH); 
     digitalWrite(switchC, LOW); 
     digitalWrite(switchD, LOW); 
     digitalWrite(switchE, LOW);  
     setA = 2;    
    }
    if(readsetA > 700)
    {
     if(readsetA < 800)
     {
      digitalWrite(switchA, HIGH); 
      digitalWrite(switchB, HIGH); 
      digitalWrite(switchC, HIGH); 
      digitalWrite(switchD, LOW); 
      digitalWrite(switchE, LOW); 
      setA = 3;     
     }
     if(readsetA > 800)
     {
      if(readsetA < 840)
      {
       digitalWrite(switchA, HIGH); 
       digitalWrite(switchB, HIGH); 
       digitalWrite(switchC, HIGH); 
       digitalWrite(switchD, HIGH); 
       digitalWrite(switchE, LOW);
       setA = 4;      
      }
      if(readsetA > 840)
      {
       digitalWrite(switchA, HIGH); 
       digitalWrite(switchB, HIGH); 
       digitalWrite(switchC, HIGH); 
       digitalWrite(switchD, HIGH); 
       digitalWrite(switchE, HIGH); 
       setA = 5;     
    }
    }
   }
   }  
  } 
    if(speek == 0 && set1 == 1)
  {
    digitalWrite(speaker, HIGH);
    delay(500);
    digitalWrite(speaker, LOW);
    speek ++;
  } 
    if(speek == 1 && set1 == 2)
  {
    digitalWrite(speaker, HIGH);
    delay(500);
    digitalWrite(speaker, LOW);
    speek ++;
  } 
    if(speek == 2 && set1 == 3)
  {
    digitalWrite(speaker, HIGH);
    delay(500);
    digitalWrite(speaker, LOW);
    speek ++;
  } 
    if(speek == 3 && set1 == 4)
  {
    digitalWrite(speaker, HIGH);
    delay(500);
    digitalWrite(speaker, LOW);
    speek ++;
  } 
    if(speek == 4 && set1 == 5)
  {
    digitalWrite(speaker, HIGH);
    delay(500);
    digitalWrite(speaker, LOW);
    speek ++;
  } 
   if(speak == 0 && setA == 1)
   {
    digitalWrite(speaker, HIGH);
    delay(500);
    digitalWrite(speaker, LOW);
    speak ++;
   }  
      if(speak == 1 && setA == 2)
   {
    digitalWrite(speaker, HIGH);
    delay(500);
    digitalWrite(speaker, LOW);
    speak ++;
   } 
         if(speak == 2 && setA == 3)
   {
    digitalWrite(speaker, HIGH);
    delay(500);
    digitalWrite(speaker, LOW);
    speak ++;
   } 
         if(speak == 3 && setA == 4)
   {
    digitalWrite(speaker, HIGH);
    delay(500);
    digitalWrite(speaker, LOW);
    speak ++;
   } 
         if(speak == 4 && setA == 5)
   {
    digitalWrite(speaker, HIGH);
    delay(500);
    digitalWrite(speaker, LOW);
    speak ++;
   } 
}
