You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I've been trying all sorts of different approaches to be able to differentiate between a long key press and a short one. I can't seem to be able to get it right as in working like i want.
This is the code i'm trying at the moment.
The difference between a long and short keypress is in the number of times the code is repeated. It's just a repeated stream of the same code - there's no way to 'extend' how long a given code takes to send. How long a code takes to send is defined by the protocol and pulse length (the pulse length is the length of individual pulses).
If you think about it, what you're doing here is getting the last code from the receiver device, and you're measuring how long it's been since that was received. That of course doesn't help for a stream of repeats.
What you need to do is see how long the repeats last for - that means trying to pick up the first one, then looking for a longer gap indicating it's stopped and measuring that time. Something like a while loop with a very small sleep, checking the timestamp reported from the library.
Hi I've been trying all sorts of different approaches to be able to differentiate between a long key press and a short one. I can't seem to be able to get it right as in working like i want.
This is the code i'm trying at the moment.
But the output is not helping
Why is it showing 0.0 ??
I want it to do something when
Long hey press
is detectedand something else when
short key
is pressedThe text was updated successfully, but these errors were encountered: