Jump to content

IF Statement based on amount of time


Recommended Posts

Posted

Add a "Wait" to your first line in the "Then"

Sent from my XT1650 using Tapatalk

  • Like 1
Posted

Use Wait, as dbuss suggests. You can also combine that with a repeat statement to keep the reminder coming at regular intervals. It will stop once the door is closed

if 
   door is on
then
   wait 5 minutes
   repeat every 5 minutes        
         send notification 'xxxxx"

    

  • Like 2
Posted

As per Paul's sample program above....

When the door is first switched ON, run the Then section until it finishes. 

However if the door lock ever becomes NOT ON, then quit running Then at the next Wait or Repeat, and start running Else, code or not.

  • Like 1
Posted
4 hours ago, paulbates said:

Use Wait, as dbuss suggests. You can also combine that with a repeat statement to keep the reminder coming at regular intervals. It will stop once the door is closed

if 
   door is on
then
   wait 5 minutes
   repeat every 5 minutes        
         send notification 'xxxxx"

    

This is what I want.  I think.  So if I forget to lock my door and its open for more than 5 mins then send me a notifications.

Posted
1 minute ago, BigEfromDaBx said:

This is what I want.  I think.  So if I forget to lock my door and its open for more than 5 mins then send me a notifications.

With the "repeat" statement, what exactly is it repeating.  Is it looping the whole if statement?

Posted
15 minutes ago, BigEfromDaBx said:

With the "repeat" statement, what exactly is it repeating.  Is it looping the whole if statement?

Just the indented line underneath it. If more lines followed they would all be indented and repeated  until another "repeat 1 times" is found.

  • Like 1
Posted
1 minute ago, larryllix said:

Just the indented line underneath it. If more lines followed they would all be indented and repeated  until another "repeat 1 times" is found.

Got it.  Thanks.

  • Like 1
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.4k
×
×
  • Create New...