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