Working with/Breaking a LOOP in CoRE?


#1

Can anyone let me know how to break a loop in CoRE? I originally had the piston setup as 2 pistons, one that refreshed sensor every 5 minutes if AC was on, stop refreshing when off. Ok, I’ll admit that it worked fine, but in the process of trying to learn variables and stuff in CoRE, I decided to try to combine the 2 into one piston.

This is my current piston, and everything works fine, except the loop never breaks. So when it refreshes the sensor, and temp is low enough to turn off the AC, it does, and it changes my status variable to false. But it continues refreshing my sensor every 5 minutes until it finishes the 100 loop. I have tried several different ways, and just can’t seem to figure out how to break a loop. I do have it working on the following example, well at least it doesn’t refresh my sensor, but it still continues the 100 loop, (Well 20 in that example), by canceling on piston state change. But I’d still like to figure out how to loop and break a loop.


( I hate Mondays) #2

CoRE is a pre-scheduled language. The FOR loop happens at piston run time, it is not delayed 300s after each cycle, instead it sets up a refresh every 5 minutes ahead of time and then runs them - this is due to how the platform works. The upcoming webCoRE tries to break away from pre-scheduling and actually run the commands in a synchronous mode. You should be able to use it, though it’s in Alpha stage.