Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

IF Statement based on amount of time

Featured Replies

Posted

I want to make an if statement that goes like this

 

if doorlock is open more than 5 mins then do something.

 

How do I do the 5 mins part?

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

Sent from my XT1650 using Tapatalk

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"

    

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.

  • Author
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.

  • Author
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?

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.

  • Author
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.

Guest
This topic is now closed to further replies.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.