* Buttons that can be “long pressed” complete a circuit that is monitored by a microprocessor.
* When it first sees the circuit connected, it starts a timer.
* When it sees the circuit open back up, it stops the timer.
* If the timer is less than the “long press time” it does action A.
* If the timer is more than the “long press time” it does action B.
* BONUS:
* Mechanical switches actually “bounce” when they make contact so the processor has to do some extra processing to figure out if the user pressed the button once or more than once.
* It is mostly done with timing. For example, the button might bounce 10,000+ times in less than a second.
* The processor knows that a human can’t press the button the fast so it assumes it was one press.
Latest Answers