#define Button 10
#define LED 12
int sw, c = 0;
void setup()
{
pinMode(LED, OUTPUT);
pinMode(Button, INPUT_PULLUP);
Serial.begin(9600);
Serial.println("Push button counter:");
}
void loop()
{
sw = digitalRead(Button);
if (sw == 0)
{
delay(250);
c++;
digitalWrite(LED, c % 2);
Serial.print(c);
if (c%2==1){
Serial.println(" - ON");
}
else{
Serial.println(" - OFF");
}
}
}