Hello, guys. I`m newbie with arduino as well as c programming
.
I would like to have a time relay which could delay on power on and contact ASAP when power off.
I tried this simple code and I have both delays, on power on/off. When I remove delay function I have instantaneous contact on power on/off.
int const outPin = 13;Â Â Â Â Â Â Â
int const inPin = 2;
void setup()
{
 pinMode(outPin, OUTPUT);  Â
 pinMode(inPin, INPUT);
}
void loop()
{
Â
 if (digitalRead(inPin) == HIGH)
 {
  delay(2000);
  digitalWrite(outPin, LOW);Â
 }
 else
 {
  digitalWrite(outPin, HIGH);
 }
}