Page 1 of 1

Stop button spamming

Posted: Mon Oct 19, 2020 8:56 am
by hobbsie
Hi All,
I have just finished phase 1 of my shop light bulb display, where i am putting an iPad in the shop for customers to turn on and off light bulbs.
I have 32 light bulbs and increasing ever more on this display.
What i dont want to do as i gave the iPad to a worker and they spammed the buttons this for light bulbs wont do them or the relays any good to be spammed.

So question is is there a way of putting some kind of timer onto a button so it cannot be hit again until 1-2 secs?

Re: Stop button spamming

Posted: Mon Oct 19, 2020 2:35 pm
by DemoPad
Sure - just use a flag. Make the actions dependent on the flag being OFF. Then after the actions have happened, immediately set the flag ON, and then set it OFF after say 10 seconds. During those 10 seconds, further attempts to execute the commands will fail because the flag will be ON. Once it goes back to being OFF, the actions will work again.