#define SW1 4
#define SW2 3
#define SW3 2
#define BUZZER 10
#define NOTE_C 523
#define NOTE_D 587
#define NOTE_E 659
void setup() {
// put your setup code here, to run once:
pinMode(SW1, INPUT_PULLUP);
pinMode(SW2, INPUT_PULLUP);
pinMode(SW3, INPUT_PULLUP);
pinMode(BUZZER, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(SW1)==LOW){
tone(BUZZER,NOTE_C);
}else if(digitalRead(SW2)==LOW){
tone(BUZZER,NOTE_D);
}else if(digitalRead(SW3)==LOW){
tone(BUZZER,NOTE_E);
}else{
noTone(BUZZER);
}
}