Code to detect single or double click

I did consider the code in #7 by running it in the wokwi.

EDIT: the code in #7 has been modified, rendering some of the statements below inoperative.

Only by using a debounced pushbutton could I get it to functional properly. This may be a wokwi problem. All I got were lotsa double click reports.

( attribute "bounce": "0" for the wokwi pushbutton component, very handy).

Once debounced externally:

The code reports a double click if you double click.

It reports a single click 250 ms after the button goes down. That is excruciating, especially the more brief one's click on the button.

In real life, I was able to see double clicks where a single click was issued, and click reports created when the button was released.

I conclude that the code is being confused by contact bouncing. If the code works better or as hoped for anyone, they are using better buttons than I am testing.


A single click report should come immediately the button goes down.

A double click report should come after a temporally proximate single click report. At the double click interval setting.

a7