int val=LOW;
void setup() {
pinMode(3, OUTPUT);
pinMode(10, INPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(3, LOW);
   val =digitalRead(10);
if (val== HIGH)
digitalWrite(3, HIGH);
else 
digitalWrite(3, LOW);
delay(1000);
}