tdmarra Posted January 21, 2013 Posted January 21, 2013 I'm using an I/O Linc and an ELK-930 to detect when someone presses the doorbell. I have a program that runs when the button is pressed. I would like to only run the program once if someone presses the button 3 or 4 times in a row. Then after 5 minutes or so it would reset and recognize the next time someone presses the button. The simple program that I have now runs every time the button is pushed, even if the button is pushed several times back-to-back. I couldn't think of a way to use variables to solve this issue. Any ideas? Thanks.
TJF1960 Posted January 21, 2013 Posted January 21, 2013 Hello, Try this If Door Bell Switch is Switched On and Integer Var1 is 0 Then Ring Bell Set Integer Var1 = 1 Wait 5 minutes Set Integer Var1 = 0 Else Tim edit: The first time the door bell switch is pushed and the var1 is 0 the program will run and ring the bell once. But the second time within the waiting period the button is pushed the program will evaluate as Fasle. So try adding a Wait 5 minutes followed by Set Integer Var1 = 0 to the Else section. Then once the switch is pushed a second time and the program evaluates to False the timer will start again. 5 minutes after they stop pushing the button the var1 will be reset to 0 which will allow the program to run and ring the bell when the switch is pushed.
elvisimprsntr Posted January 21, 2013 Posted January 21, 2013 I use the Elk DB module with an IOLinc and IP camera with GPIO at my front door. When someone presses the doorbell. I turn on the light, close IOLinc relay which triggers the camera to send a picture to my phone. I don't have to get off the couch to see who it is. Usually it's a package delivery.
tdmarra Posted January 22, 2013 Author Posted January 22, 2013 Thanks Tim, that worked perfectly. I guess I did not realise that you could have multiple instances of the same program running at the same time. Thanks again, Tom
TJF1960 Posted January 22, 2013 Posted January 22, 2013 Hi Tom, Glad it worked out for you. Actually its not multiple instances. Anytime there is a Wait in the action, either in the Then or the Else and something changes in the If the program will re-evaluate. In this case the only trigger is the bell button being pushed. The Integer variable will not cause a re-evaluation. Anyway, glad it worked and thanks for posting back. Tim
Recommended Posts