Why does the LED turn on after the while loop becomes false?

because the code being executed has delays, there's no need to debounce.

in other cases recognizing a change and delaying for 20 msec is sufficient

1 Like