Logic Machine Forum
Trigger an event when button is pressed down but not released - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Trigger an event when button is pressed down but not released (/showthread.php?tid=212)



Trigger an event when button is pressed down but not released - Sniver - 05.02.2016

Hi all, I am fairly new in scripting using lua but I am quite experienced in other programming languages. I find it hard to determine how I can trigger an event after pressing down a button. I see that events are triggered after release of the button which means, event is triggered on Rising Edge of the button data. Can any body tell me if what I intend to do is possible?
Thank you in advance for your help.


RE: Trigger an event when button is pressed down but not released - admin - 05.02.2016

Depends on how your button is configured. Most physical button inputs have rising (on) and falling (off) edge detection. You can set a fixed value to both actions, so in your script you can use event.getvalue() to figure out if button is pressed or released.


RE: Trigger an event when button is pressed down but not released - Sniver - 05.02.2016

(05.02.2016, 17:56)admin Wrote: Depends on how your button is configured. Most physical button inputs have rising (on) and falling (off) edge detection. You can set a fixed value to both actions, so in your script you can use event.getvalue() to figure out if button is pressed or released.
Hi admin, thanks for the quick reply! unfortunately, I am using a button in SpaceLynk, not a an actual physical button. And I can't find the right material to instruct me how to set the trigger of the button to either an risin or falling trigger. Right now, as observed, events are only triggered after button released.


RE: Trigger an event when button is pressed down but not released - Erwin van der Zwart - 06.02.2016

Hi Sniper,

Currently there is only 1 event  (on release) in spaceLYnk, i discussed this with the
DEV team to add a extra event in future FW. This way we could use long/short press etcetera.

As far as i know it's not implemented yet (and also not confirmed that it will be added)
but it could be possible with Javascript in new FW. I didn't try to create this but i think 
we could create your wanted feature with it.

I hope (just like you) we have 2 events on button in one of the upcomming FW version.. 

BR,

Erwin van der Zwart


RE: Trigger an event when button is pressed down but not released - Sniver - 10.02.2016

(06.02.2016, 19:14)Erwin van der Zwart Wrote: Hi Sniper,

Currently there is only 1 event  (on release) in spaceLYnk, i discussed this with the
DEV team to add a extra event in future FW. This way we could use long/short press etcetera.

As far as i know it's not implemented yet (and also not confirmed that it will be added)
but it could be possible with Javascript in new FW. I didn't try to create this but i think 
we could create your wanted feature with it.

I hope (just like you) we have 2 events on button in one of the upcomming FW version.. 

BR,

Erwin van der Zwart


Hi Erwin,
    Thanks for your reply. Now I have confirmation that it was not supported. However, do you know any variable or group address that changes when the button is pressed? We may be able to track its status and have it be the trigger for our event. So far, I have not found any. And I think I might go with your suggestion to use Javascript. 

    Thanks!