Stop button spamming

Forum to ask for any help
Post Reply
Posts: 7
Joined: Thu Feb 07, 2013 7:38 pm

Stop button spamming

Post by hobbsie » Mon Oct 19, 2020 8:56 am

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?

User avatar
Site Admin
Posts: 764
Joined: Thu Jun 14, 2012 10:46 am

Re: Stop button spamming

Post by DemoPad » Mon Oct 19, 2020 2:35 pm

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.

Post Reply