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.

Variable & Program help

Featured Replies

Posted

I have a kitchen light (2466DW) and a sink light (2474DWH).  I want to switch the kitchen light on if I press The sink light on three times.  I made a variable $KLCount and the following programs:

Upcount (Works)

If 

Control 'SinkLight' is switched On

Then

$KLCount += 1

---------------------------------------------------------------------------------------------

CountReset (Works)

if

Control 'SinkLight' is switched off

or Control 'KitchenLight' is switched off

Then

$KLCount = 0

-------------------------------------------------------------------------------------------------

KLOn (Not Working)

If

$KLCount >= 3

Then

Set 'KitchenLight' on

Wait 2 seconds

$KLCount =0

------------------------------------------------------------------------------------------------------

So as I've indicated it seems everything is working except when it come to turning the kitchen light on (The counter will go over three and the light will not come on and counter will not reset unless I turn one of the switches off.

Any ideas as to why this won't work??  Thanks for any help you can provide

 

Put the logic to turn on the light in your first program, something like this:

IF

   Control 'SinkLight' is switched on

and $KLCount >= 3

Then

  Set 'KitchenLight' on

  wait 2 seconds

  $klCount =0

else

 KLCount +=1

 

The other thing to try is a state variable, I think those will activate a program, while a change in an integer var does not?

...

if $KLCount >= 3

Then $OnFlag = 1

 

  • Author
55 minutes ago, smacbride said:

Put the logic to turn on the light in your first program, something like this:

IF

   Control 'SinkLight' is switched on

and $KLCount >= 3

Then

  Set 'KitchenLight' on

  wait 2 seconds

  $klCount =0

else

 KLCount +=1

 

Yep That worked...will try messing with state variables at another time

Thanks again

Archived

This topic is now archived and is 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.