#define button 4
#define led1 8
#define led2 10
#define buz 2
void setup() {
// put your setup code here, to run once:
pinMode(button, INPUT);
pinMode(buz, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int buttonPress;
buttonPress= digitalRead(button);
if (buttonPress==HIGH){
Serial.println("Button is pressed");
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
tone(buz,600);
delay(10000);
}else{
digitalWrite(led2, HIGH);
digitalWrite(led1, LOW);
noTone(buz);
}
}