void setup() {
// put your setup code here, to run once:
pinMode(10, OUTPUT);
pinMode(8, INPUT_PULLUP);
Serial.begin(9600);
}
int counter = 0;
void loop() {
// put your main code here, to run repeatedly:
int switchState = digitalRead(8);
if(switchState == 0)
{
digitalWrite(10, HIGH);
Serial.println("SWITCH ON, LED ON");
counter = counter + 1;
Serial.println(counter);
delay(1000);
}else{
digitalWrite(10, LOW);
Serial.println("Switch OFF, LED OFF");
}
}