(I've put this under Sensors, since a switch is a sensor...)
With a need to debounce a switch in a project, I decided to check out the debounce tutorial
for the first time.
I understand the debounce stuff... allowing a certain time to pass before "accepting" the press; happy with that.
But the tutorial says it also acts as a toggle switch:
This example demonstrates the use of a pushbutton as a switch: each time you press the button, the LED (or whatever) is turned on (if it's off) or off (if on)
Well it doesn't toggle for me: just works as a normal (albeit debounced) momentary switch... the LED is on when the switch is pressed, and off when it's not. It doesn't stay on after a press-release, it goes off.Walking through the code, I see where the debounce comes in, but don't see a toggle mechanism.
Is the narrative to the tutorial out of whack with the code, or am I missing the plot, here?
Edit: I don't need a toggle switch, I actually just need a debounced momentary switch, so I'm not fussed that it isn't a toggle. Just confused in case it is
a toggle and I'm not getting that part.