turls Posted May 13, 2015 Share Posted May 13, 2015 Ought to see a LOT more of this, shouldn't have to dig here or wait for a C4 blog to reference it: http://nycesensors.com/support/control4-lighting-examples/ msgreenf 1 Quote Link to comment Share on other sites More sharing options...
thecodeman Posted May 13, 2015 Share Posted May 13, 2015 Oooo. theres a wild "loop" program in there. So you don't want someone to write it up here/on a blog, and want to hope manufacturers do this and make it available on their site? Quote Link to comment Share on other sites More sharing options...
turls Posted May 14, 2015 Author Share Posted May 14, 2015 Oooo. theres a wild "loop" program in there. So you don't want someone to write it up here/on a blog, and want to hope manufacturers do this and make it available on their site? I think you should get a large batch of sample programming as part of a purchase like this, or when you purchase a system or Composer HE (right now it depends on your dealer more than anything). But yeah, if the loop isn't good then they ought to leave it to the experts. I wondered about that loop... Quote Link to comment Share on other sites More sharing options...
thecodeman Posted May 14, 2015 Share Posted May 14, 2015 I hear what you're saying. That was the main point for having c4central back when it was first started with Dan & I. Quote Link to comment Share on other sites More sharing options...
CFUG Posted May 14, 2015 Share Posted May 14, 2015 What is big beef with WHILE loops?? I use them all the time with motion sensing equipment. The work fine. Quote Link to comment Share on other sites More sharing options...
Cyknight Posted May 14, 2015 Share Posted May 14, 2015 The big issue that they potentially heavily bog down controllers. Timers are much safer options than WHILE statements. Plus Timers can be 'manually' stopped if required with a custom button, schedule et al. Examples of issues: WHILE light is ON...and then that light senses an overload and goes into protection. You'll have NO way of remotely cutting the loop. WHILE TV current input is...someone manually changes the input... Careful use can be fine, but there are perfectly good alternatives available for almost ANY situation - using timers, start/stop commands vs pulse and so-on. Even something likeWHILE security is in alarm statetoggle lightdelay 1 secondWhy bother? Just doWHEN security goes to alarm stateStart 1 second timer When 1 second timer expires When security alarm state clearedStop timer Yes that's more lines, HOWEVER that WHILE statement is VERY likely to have created a back-log in the system and will likely continue to toggle the light for several seconds, in somne cases several minutes or even longer. Even on your motion, the WHILE statement is sending constant light on traffic across the ZigBee mesh - both from the motion potentiatlly, but for sure the light.Using timers there only sends occasional traffic - basically only once when you turn the light on, and once when you turn it off. I won't say it's WRONG to use WHILE statements, but it should be used with caution if at all. The alternatives, while a few extra lines of code, are often simply better. turls, SMHarman and thecodeman 3 Quote Link to comment Share on other sites More sharing options...
Benoît van Osch Posted February 26, 2020 Share Posted February 26, 2020 Interesting read even though its 5 years old! I would like to program something like this and don't seem to be able to get this working with either a while or an if statement. Some thoughts on this would be very much appreciated. IF CorridorAlarmSensor senses motion THEN MasterBedroomAlarmSensor should sense motion within 10 seconds if someone enters the room, in which case: do nothing ELSE (Someone has left the room), and reset RoomOccupied=FALSE P.S. I want to ensure RoomOccupied is only reset when someone leaves the room, and not when someone enters the room. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.