Detect button hold duration for specific action

Forum to ask for any help
Post Reply
NicoF
Posts: 1
Joined: Wed Aug 29, 2012 2:15 pm

Detect button hold duration for specific action

Post by NicoF » Tue Sep 04, 2012 10:17 pm

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

User avatar
DemoPad
Site Admin
Posts: 769
Joined: Thu Jun 14, 2012 10:46 am
Contact:

Re: Detect button hold duration for specific action

Post by DemoPad » Wed Sep 05, 2012 2:12 pm

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.

Post Reply