Page 1 of 1

Detect button hold duration for specific action

Posted: Tue Sep 04, 2012 10:17 pm
by NicoF
what I want to do:

* short press on button 1 and release => action on button release = "select channel 1"
(http://hd1.freebox.fr/pub/remote_control?key=1)

* long press on button 1 (let's say 400ms) => action on long press before button release "prepare channel 1x"
(http://hd1.freebox.fr/pub/remote_contro ... &long=true)

which is the current remote method to select 1x or 1xx channels.

Is there a way to do that within Demopad?

Thanks for upcoming help

Re: Detect button hold duration for specific action

Posted: Wed Sep 05, 2012 2:12 pm
by DemoPad
Yep...have 2 flags, called long press and button released.

When you depress the button, have these actions:

Set button released to OFF
Set long press to OFF
set long press to ON, after say 3 seconds, dependent on button released being OFF

On the release action:
set button released to ON
Set button released to OFF, after 4 seconds

Now execute one set of actions dependent on long press being ON, and another set of actions dependent on long press being OFF.