//#include <Arduino.h>
#define buttonPin 3
#define ledPin 7
#define buzz 6
void setup(){
pinMode(buttonPin,INPUT);
pinMode(ledPin,OUTPUT);
pinMode(buzz,OUTPUT);
}
//0=LOW; 1= HIGH
void loop(){
int readFromButton;
readFromButton = digitalRead(buttonPin);
if (readFromButton == 1){
digitalWrite(ledPin,HIGH);
tone(buzz,500);
delay(2000);
}
else{
digitalWrite(ledPin,LOW);
noTone(buzz);
}
}