Electronic debouncer on limit switches

It seems that the limit switches are set to normally open and pulled up by the Arduino.
I would like to experiment with a normally open switch debounced by a Schmitt trigger.

(1) Has anybody tried reversing the grbl code, so the condition on digital pin?
(2) Has anybody experimented with INVERT_CONTROL_PIN option?
(3) Are any side effects besides the limit switches?

One should be able to debounce in the code rather than adding external hardware, providing you have access to the code. When it listens to the input if it senses a button press, send it to a function that waits 50 milliseconds or so to see if the button is still pressed. The function then returns the true button state. Here is a tutorial - but they put it all in the main loop - it should be offloaded to a function.


There is a software de-bounce for homing:

$26=250 (homing debounce, msec)

If you are really talking about limit switches that’s another issue that has many threads on this forum.

I reversed the limit switches to normally closed, this is working great. And now when the switch is disconnected it doesn’t crash into the top during homing.