When the input goes High, the LED immediately turns on. When the input goes low, the LED takes between 2 - 5 seconds to switch off (the time varies, can't work out based on what yet). Otherwise the circuit works as expected.
Code:
Code: Select all
int reading;
int testPIN = 13;
int inputPIN = 5;
void setup()
{
pinMode(testPIN, OUTPUT);
pinMode(inputPIN, INPUT);
}
void loop()
{
reading = digitalRead(inputPIN);
if (reading == HIGH)
{
digitalWrite(testPIN, HIGH);
}
else
{
digitalWrite(testPIN, LOW);
}
}