LDWelton Posted October 17, 2018 Share Posted October 17, 2018 I have a kitchen light (2466DW) and a sink light (2474DWH). I want to switch the kitchen light on if I press The sink light on three times. I made a variable $KLCount and the following programs: Upcount (Works) If Control 'SinkLight' is switched On Then $KLCount += 1 --------------------------------------------------------------------------------------------- CountReset (Works) if Control 'SinkLight' is switched off or Control 'KitchenLight' is switched off Then $KLCount = 0 ------------------------------------------------------------------------------------------------- KLOn (Not Working) If $KLCount >= 3 Then Set 'KitchenLight' on Wait 2 seconds $KLCount =0 ------------------------------------------------------------------------------------------------------ So as I've indicated it seems everything is working except when it come to turning the kitchen light on (The counter will go over three and the light will not come on and counter will not reset unless I turn one of the switches off. Any ideas as to why this won't work?? Thanks for any help you can provide Link to comment
smacbride Posted October 17, 2018 Share Posted October 17, 2018 Put the logic to turn on the light in your first program, something like this: IF Control 'SinkLight' is switched on and $KLCount >= 3 Then Set 'KitchenLight' on wait 2 seconds $klCount =0 else KLCount +=1 Link to comment
smacbride Posted October 17, 2018 Share Posted October 17, 2018 The other thing to try is a state variable, I think those will activate a program, while a change in an integer var does not? ... if $KLCount >= 3 Then $OnFlag = 1 Link to comment
LDWelton Posted October 17, 2018 Author Share Posted October 17, 2018 55 minutes ago, smacbride said: Put the logic to turn on the light in your first program, something like this: IF Control 'SinkLight' is switched on and $KLCount >= 3 Then Set 'KitchenLight' on wait 2 seconds $klCount =0 else KLCount +=1 Yep That worked...will try messing with state variables at another time Thanks again Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.