int notes[] = {262,294,330,349};
int Pb1 = 2;
int Pb2 = 3;
int Pb3 = 4;
int Pb4 = 5;
void setup() {
// put your setup code here, to run once:
// Serial.begin(9600);
// buttons[0] = 2;
pinMode(Pb1, INPUT_PULLUP);
pinMode(Pb2, INPUT_PULLUP);
pinMode(Pb3, INPUT_PULLUP);
pinMode(Pb4, INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
// int keyVal = analogRead(A0);
// Serial.println(keyVal);
// int keyVal = 0;
// Serial.println(digitalRead(Pb1));
if (digitalRead(Pb1) == 0)
{
tone(8, notes[0]);
}else if (digitalRead(Pb2) == 0)
{
tone(8, notes[1]);
}else if (digitalRead(Pb3) == 0)
{
tone(8, notes[2]);
}else if (digitalRead(Pb4) == 0)
{
tone(8, notes[3]);
}
else{
noTone(8);
}
// if(keyVal == 1023){
// tone(8, notes[0]);
// } else if(keyVal >= 990 && keyVal <= 1010){
// tone(8, notes[1]);
// }
// else if(keyVal >= 505 && keyVal <= 515){
// tone(8, notes[2]);
// }
// else if(keyVal >= 5 && keyVal <= 10){
// tone(8, notes[3]);
// }
// else{
// noTone(8);
// }
}