• Thank you!
    Can you please explain the code? I am a bit confused with all the "pullups" =)
    So we set a variable pulledUp to true and counter to zero.
    Then every 10s we check.
    I am confused with the else part - if we set pulledUp to false during "stuck LED" condition, then the first IF will get executed after 10 seconds, which will cause a reading update?
    Should it not be other way around? I am confused =)

      if (D2.read()) { // LED is off - all ok
        onCount = 0;
        pulledUp = FALSE;
      } else {
        onCount++;
        if (onCount>6) { // >60 secs on
          pulledUp = TRUE;
        }
      }
    

    Also, what is the difference between

     if (!pulledUp) pinMode(D2,"input_pullup");
    

    in the beginning and

    if (!pulledUp) pinMode(D2,"input");
    

    in the end? Or the first one suppose to be true and the last one false?

About

Avatar for user130485 @user130485 started