With the internal pull-up resistor turned on, I'll attach a push button to one of the microcontroller's GPIO pins and set it up as an input. I'll use millis() in the program to calculate the interval between button press and release events. "If the button is released quickly (less than 1 second), I will check if another press occurs within 400 ms to classify it as a double click." "If only one press occurs within the timeout, I will classify it as a single click." "If the button is held down longer than 1 second before release, I will classify it as a long press. Each detected action will be printed to the serial monitor"
https://wokwi.com/projects/442627153554544641
Add a video of the output (know more)