Jump to content

random command execution


smiley73

Recommended Posts

Hi,

 

I'm trying to write a program which simulates a TV being on, using a dimmer (as part of my vacation programs).

This is what I currently have:

If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

Then
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' 50%
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' 75%
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' On

Else
  - No Actions - (To add one, press 'Action')

 

I was hoping that the "Repeat 1 times (Random)" would work to randomly execute certain statements, but that didn't work so well. I guess the 'randomness' is between 1 and the value specified (was hoping it's 0).

Is there another way to randomly execute statements?

 

Thanks

Heiko

Link to comment

Hi Heiko,

 

Repeating random (in your case) means that it would either repeat the block or not execute at all.

 

I think what you need is to use the Random function on Wait instead of repeat. This way, the amount of time waited for the next statement will be random.

 

With kind regards,

Michel

Hi,

 

I'm trying to write a program which simulates a TV being on, using a dimmer (as part of my vacation programs).

This is what I currently have:

If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

Then
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' 50%
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' 75%
       Repeat 1 times (Random)
          Wait  3 seconds
          Wait  3 seconds (Random)
          Set 'LR LampLinc TV' On

Else
  - No Actions - (To add one, press 'Action')

 

I was hoping that the "Repeat 1 times (Random)" would work to randomly execute certain statements, but that didn't work so well. I guess the 'randomness' is between 1 and the value specified (was hoping it's 0).

Is there another way to randomly execute statements?

 

Thanks

Heiko

Link to comment
Repeating random (in your case) means that it would either repeat the block or not execute at all.

That's exactly what I want, randomly executing the block (or not). Unfortunately it doesn't seem to work, it always executes all the blocks.

 

I think what you need is to use the Random function on Wait instead of repeat. This way, the amount of time waited for the next statement will be random.

Using Wait is my backup solution, but this would cause my TV simulation not to be random. It would always go from 50%, to 75%, to 100%. I could probably make the code a bit more extensive, so it looks more random.

 

Heiko

Link to comment

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...