JGLI Posted March 9, 2017 Share Posted March 9, 2017 I'm trying to write some code to blink lights at a certain time. They go off, but don't come back on. I figured I would put a 2 second delay in, but its not working. Here is the code, what am I doing wrong? Blink.tiff Link to comment Share on other sites More sharing options...
South Africa C4 user Posted March 9, 2017 Share Posted March 9, 2017 If you want something to happen when the timer expires (e.g. The lights to turn back on) then you need to put that code in the timer expires event. So delete your if statement and all the code nested under it. Go to the timers on the left hand side of the screen and choose your 2 second timer. Then choose the on expires event for this timer. In that section add the two lines of code to turn the two lights on. If you want to repeat this (E.g. Have them flashing on and off every 2 seconds for a minute) you can use a repeating timer (I've no idea how to do this) or have a second timer which is a 1 minute timer which you start at the same time as you currently start your 2 second timer and in the code for the 2 second timer expires you do the following: turn on lights (2 lines of code) delay 2 seconds turn off lights (2 lines of code) if one minute timer is running Start 2 second timer Hope that helps! Link to comment Share on other sites More sharing options...
South Africa C4 user Posted March 9, 2017 Share Posted March 9, 2017 By the way, as far as I know, there is also a flash lights option in the advanced lighting scenes which would probably be a much better / simpler way to do this! Link to comment Share on other sites More sharing options...
Cyknight Posted March 9, 2017 Share Posted March 9, 2017 Timer 2 seconds repeating. 'Flash' Number variable 'Counter' WHEN timer expires Variable->Counter = Variables_>Counter +1 {adds 1 to the counter) Toggle Light {use toggle for two reasons. First it's lesss programming, second it will end up reverting the light to where it was before (well at least to where it was on or off} Plus When the variable Variables->Counter changes IF Variables->Counter equals 30 {or whatever runtime (x2 seconds) you want, just make it an even number to ensure the toggle light returns to 'original' state} STOP timer->Flash Variables->Counter = 0 As mentioned, advanced lighting scenes have a flash option, but note that it only works on the current gen lighting (and unsure on 3rd party lights compatibility) - but if you'd like to return to previous state - the above is probably still simpler to use. Link to comment Share on other sites More sharing options...
eddy.trochez Posted March 9, 2017 Share Posted March 9, 2017 I have a scene like this in my system. Lights flash twice when the bell button is pressed. I created a flashing scene in the Advanced Lighting agent. When bell button is pressed Take snapshot Activate flashing scene Recall snapshot It works very nicely. Link to comment Share on other sites More sharing options...
JGLI Posted March 9, 2017 Author Share Posted March 9, 2017 Thanks guys. Will try the advanced lighting option. Link to comment Share on other sites More sharing options...
JGLI Posted March 9, 2017 Author Share Posted March 9, 2017 How do you stop the flashing in Advanced Lighting. I just want to flash once... Link to comment Share on other sites More sharing options...
eddy.trochez Posted March 9, 2017 Share Posted March 9, 2017 You don't use the flash option. You use actions. Add actions to each light and set the level for each action. Link to comment Share on other sites More sharing options...
JGLI Posted March 9, 2017 Author Share Posted March 9, 2017 activate worked. thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.