Jump to content

Question about the repeat command


Blackbird

Recommended Posts

Posted

Can you use the "Repeat" command in a program, to only repeat the line above it or does it repeat all lines within the "then" group?  For example when I close my back door I want a few lights to go out but sometimes they don't always go out so I wanted to only repeat the porch light turning off.

 

Thanks

Posted

The statement(s) after the Repeat until next Repeat

 

 

Then
        ....
        Repeat 3 times
           Set 'ICON Relay 2' Off
        Repeat 1 times
 
Else
Posted

The Repeat 1 time ends the Repeat loop above.  It allows other statements to be coded after the Repeat 1 time that do not participate in the Repeat 3 times loop.

Posted

Since the topic is about the command itself, I'll add the placing one or more statements between Repeat 0 times and Repeat 1 time has the same effect as REMing those statements. The ISY does not provide a REM command. Great for troubleshooting a program.

  • Like 1
Posted

So in your example above? If I just use the repeat 3 line then a command and nothing else, it would repeat that command. If I had another line after the one I wanted repeated, I need to put repeat 1 then a new command?

Posted (edited)

The Repeat range is to the end of the clause (Then or Else), or to the next Repeat.  In this example the Set, and all statements after that are repeated

 

Then
        ....
        Repeat 3 times
           Set 'ICON Relay 2' Off
            statement 1
            statement 2
Else 
 
In this example the Set is the only statement that is repeated
 
Then
        ....
        Repeat 3 times
           Set 'ICON Relay 2' Off
        Repeat 1 time
           statement 1
           statement 2
Else
Edited by LeeG
Posted

 

Perhaps that was not the question.

 

I thought I made it clear that I was referring to the topic, specifically, Question about the repeat command

 

Since the topic is about the command itself ...

 

I guess I wasn't specific enough.

 

Lee, you are correct. I should not be so terse B)

  • 1 year later...
Posted

Old topic... but one I had to look up.

Can I just say that ending a repeat loop with a repeat statement is NOT intuitive.

 

Agreed :)

Posted

Perhaps.  But if you want to truly dishearten a customer, you develop tools that frustrate them for hours because of something that isn't consistent with almost every programming language out there.  The syntax looks more like a workaround.

Posted

Just your old fashioned "repeat until" loop that's been around for many years. Fairly standard, only with a few different words.

 

The until is just repeat 1 (once).

Totally intuitive, but intuitive is only relative to your experience. We weren't born programming via a keyboard. QWERTY? Really? I have used many different styles of languages. There is no "intuitive". There is no standard style of repeat.

 

The admin console even indents the contents for you so you now where it begins and ends (even without those words Mr. Pascal). That is way past where I started programming.

 

Now for the syntax quirk. You should love this one.

 

..."Repeat 1 times"

doesn't repeat the loop at all. It only executes it once. :)

 

Have a good one!

Posted

If UD just put a note there that said "to end repeat, select repeat 1 times" that would take care of it.  

Add an "end" to the pulldown menu list of times was suggested before.

 

Repeat X times

...do something

Repeat End

 

Like any other language you have to learn the syntax and then use it.

Posted

Add an "end" to the pulldown menu list of times was suggested before.

 

Repeat X times

...do something

Repeat End

 

Like any other language you have to learn the syntax and then use it.

If you are going to do that, I would put it in the pull down column that includes the "for/while/etc".  

Posted

If you are going to do that, I would put it in the pull down column that includes the "for/while/etc".  

Sure, but I am waiting for logic line enable trigger options first, well at least for a repeating while :)

Posted

Sure, but I am waiting for logic line enable trigger options first, well at least for a repeating while  :)

I'm not sure what you mean.  But "repeat while" is an option, I believe this is a new option in the 5.x

 

It includes integer variables as options for repeat while, so I guess it actively checks with each cycle?

Posted (edited)

I'm not sure what you mean.  But "repeat while" is an option, I believe this is a new option in the 5.x

 

It includes integer variables as options for repeat while, so I guess it actively checks with each cycle?

It was an attempt at a pundle.

I thought you would be right on top of V5.

 

Have  a look as this usage for the repeat while....

http://forum.universal-devices.com/topic/18921-v5-averaging-using-only-the-best-values/

Edited by larryllix
Posted

Glad to add a little humor into a thread. Still stay not intuitive even compared to assembly language on a Pdp-11. Plenty of experience here.

 

 

Sent from my iPhone using Tapatalk

5x is not an option until it is released.

 

 

Sent from my iPhone using Tapatalk

Posted

Glad to add a little humor into a thread. Still stay not intuitive even compared to assembly language on a Pdp-11. Plenty of experience here.

 

 

Sent from my iPhone using Tapatalk

5x is not an option until it is released.

 

 

Sent from my iPhone using Tapatalk

PDP-11?  No PDP-8? Just a newbie! :)

Posted

Okay, this thread has me a little confused.  I wrote this little program to demonstrate my question. 

 

I want to water in some grass seed on the back lawn that suffered some winter/dog damage.  Is there a way, within this program, to have the repeat clause reevaluate the conditions in the "if" statement prior to each repeat cycle (the climate module stuff is dynamic and would optimally be reevaluated each time the program repeats)?  I was fairly certain that the "if" clause isn't reevaluated with each repeat cycle, but suddenly I'm unsure about that.  Normally, I'd use one program to call other programs based on values from the climate module to accomplish this.  Is that correct?

BackLawnReSeed - [ID 008A][Parent 0089]

If
        From     7:00:00AM on 2017/05/05
        To      10:00:00PM on 2017/05/20
    And (
             From    Sunrise +  4 hours 
             To      Sunset  -  1 hour  (same day)
         And (
                  Module 'Climate' Temperature > 50 °F
              And Module 'Climate' Total Rain Today < 0.2 "
              And Module 'Climate' Wind Speed < 15 mph
             )
        )
 
Then
        Repeat Every  2 hours 
           Set 'Devices / dirNodeServers / RainMachine / RainMachine / Rear Lawn' Start
           Wait  10 minutes 
           Set 'Devices / dirNodeServers / RainMachine / RainMachine / Rear Lawn' Stop
 
Else
   - No Actions - (To add one, press 'Action')
 

Thanks in advance.  This forum is invaluable!

Guest
This topic is now closed to further replies.

×
×
  • Create New...