int switchState = 0;
void setup() {
// put your setup code here, to run once:
pinMode(3, OUTPUT);
pinMode(2, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
switchState = digitalRead(2) ;
if (switchState == LOW)
{
digitalWrite(3, HIGH);
delay(500);
digitalWrite(3, LOW);
delay(500);
}
else
{
digitalWrite(3, HIGH);
delay(500);
}
}