int led=7;
int bu=6;
int sw=5;
int count=0;
void setup() {
// put your setup code here, to run once:
pinMode(led,OUTPUT);
pinMode(bu, OUTPUT);
pinMode(sw,INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(sw)==HIGH)
{
count++;
tone(bu,300);
delay(350);
noTone(bu);
}
if(count%2==1)
{
digitalWrite(led,HIGH);
}
else
{
digitalWrite(led,LOW);
}
delay(300);
}