05-17-2016 04:34 PM
I noticed that if the booliean button is set to "switch until released" or "latch until released", a button press will trigger the event twice. Of course for the "switch...", we have to set the value back to false to bounce back the button. The other four mechanical actions will trigger event only once. This is not the desired behavior for me, and I need to use the "switch until released". Any way I can work around this? Thanks.
Solved! Go to Solution.
05-17-2016 04:51 PM
There is no way around triggering the event twice with that mechanical action but you can put a case structure inside the event with the button value wired into it. If true, execute your code. If FALSE, do nothing.
05-17-2016 05:05 PM
The attached file can show this kind of behavior. This is for sending command repeatedly while holding down a button, but I just realized a swift button press will send two commands.
05-17-2016 05:40 PM - edited 05-17-2016 05:40 PM
@guangdew1 wrote:The attached file can show this kind of behavior. This is for sending command repeatedly while holding down a button, but I just realized a swift button press will send two commands.
No, it does not. A quick press&release will send no command, because you'll release before the 500ms timeout at which point the boolean is back to false and the timeout is back to infinite. The timeout event never executes.
(It would help to keep all discussions in one thread, and, as I said, don't ever attach modified code under the same name as one of my original attachments.)
05-17-2016 05:40 PM
Part of the event data is going to be "New Value". You can use this data (found on the left side of the event structure) to determine what action to take.
05-17-2016 05:57 PM
My previous attached example didn't send command twice. This attached file shows this kind of behavior, try press the dial buttons then press the back space "BS" button. Thanks.
05-17-2016 06:07 PM
@guangdew1 wrote:My previous attached example didn't send command twice. This attached file shows this kind of behavior, try press the dial buttons then press the back space "BS" button. Thanks.
And it does exactly as you programmed it. If you are just switching the value back programmatically like that, you should just use a Latch When Released.
05-17-2016 06:16 PM
I used "switch until released" because I want to have the capability to back space repeatedly while hold down the button, even though this function is not added to it yet. I want to the button to back space once when pressed briefly and keep on back space when hold down the button.
05-17-2016 09:54 PM
05-17-2016 10:12 PM
Mikeporter, this is all about buttons on the front panel. Back space is the "BS" button on the lower right corner.