• ok... I think I get it now =) thank you for your patience - my brain must be functioning in another way =) But running through it I feel I still dont get it =)
    Lets imagine that LED is not stuck and its functioning as needed. And LED is currently OFF during the time this check is done.
    Running through this function makes it:
    pulledUp=true
    first IF is not fired up, as pulledUP variable is true
    second IF is fired up and sets pulledUP variable to true again
    third IF is not fired up as pulledUP variable is true

    Now, there is a brief pulse of LED light, which is a normal meter functioning, but outside the function's 10second loop.
    How does my setWatch function work if we did not set the pinMode for D2 to be input_pullup?

      setWatch(function(e) {
        if (!pulledUp) return;
        c.inc(1);
        pulseTotal++;
        update();
        if (LEDStatus==1){
          digitalPulse(LED1,1,1); // show activity
        }
      }, D2, { repeat:true, edge:"falling" });
    

    I keep wanting to change

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

    to

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

    Just dont understand how it works without changing the pinMode if pulledUp variable is staying true on the "unstuck" day

About

Avatar for user130485 @user130485 started