Try a simple test .Configure one pin as Input and another as Output.
Connect a jumper between the two.
Create a Boolean called PinStatus.. Set it False at the beginning and then turn On the Output.
#define Led=13;
#define Inpin 5;
#define Outpin 6;
Boolean PinStatus;
void setup()
{
pinMode(Inpin,INPUT);
pinMode(Outpin,OUTPUT);
PinStatus=False;
}
void loop()
{
digitalWrite(Outpin,HIGH);
PinStatus=True;
if (PinStatus== True)
{
digitalWrite(Led,HIGH);
}
delay(1000);
digitalWrite(Outpin,LOW);
PinStatus=False;
delay(1000);
if (PinStatus== False)
{
digitalWrite(Led,LOW);
}
}