You are reading a single comment by @avanc and its replies. Click here to read the full conversation.
  • Hello,

    this weekend I got my reed switch from Sigma and connected it to my pico (GND and B3). As proposed, I set the pin to input_pullup and wrote a basic watch function:

    setWatch(function(e) {
      pincounter++;
      console.log(pincounter+"\n");
      },
      B3,
      {repeat: 'true', edge:'rising', debounce:10}
    );
    

    Now I get some strange behaviours with different options:
    edge: 'rising' no debouncing
    Most of the time two events when moving magnet to sensor and one when moving away.

    edge: 'rising', debounce: 10
    One event when moving magnet to sensor and one when moving away. The same for debounce 100 and 1000.

    edge: 'falling', no debounce
    Three events when moving magnet to sensor and no event when moving away.

    edge: 'falling', debounce: 10
    No events at all.

    Not exactly what I expected. Am I right that it seems that the reed switch only closes very short but not keep closed while the magnet is next to the sensor?

About

Avatar for avanc @avanc started