const int led1 = 12;
const int buz = 13;
void setup() {
// put your setup code here, to run once:
pinMode(led1, OUTPUT);
pinMode(buz, OUTPUT);
pinMode(7, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int button = digitalRead(7);
if (button==HIGH) {
tone(buz,1000);
digitalWrite(led1, HIGH);
}
else {
noTone(buz);
digitalWrite(led1, LOW);
}
}