void setup() {
pinMode(12, OUTPUT);
pinMode(3, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int buttonstate=digitalRead(3);
if(buttonstate==LOW)
{
digitalWrite(12, HIGH);
Serial.println("Switch ON");
delay(5000);
}
else{
digitalWrite(12, LOW);
Serial.println("Switch OFF");
delay(5000);
}
}