Forum: µC & Digital Electronics Arduino double click button

von Maurice W. (iciwi)

Rate this post
0 useful
not useful
Hey there,
I want to add a double click function in my code. But how can I do this?
And is ther a possiblity to distinguish between a normal click and a 
double click?

I'm looking forward to your replies.

Best regards

Maurice W.

von Toto mit Harry (Guest)

Rate this post
0 useful
not useful
Int Clickcount
Int mydoubleclicktimeout()
Int mylastclick
Mypinstatus //debounced

Else if(mypinstatus&&clickount==1&&millis()<=mylastclick+mydoubkeclicktimeout)
Else if(mypinstatus&&clickount==1&&millis()>=mylastclick+mydoubleclicktimeout)

von Quax (Guest)

Rate this post
0 useful
not useful
You can use this library: https://github.com/TOLDOTECHNIK/TTBOUNCE
It has a double click event and also debounces your hardware button.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.