Posts Tagged ‘variables’
“How do I…†save states using a variable?
Last Updated on Thursday, 29 April 2010 04:23 Written by Cody Tuesday, 16 March 2010 11:35
Variables provide other programming options not available by using Commands, Conditionals or loops. Today we will talk about how to save states using the ‘device’ and ‘integer’ variables.
In 1.3.2 and later, they have modified programming to include a Set to value. This makes it easier to save the current selected device or its properties so that we can go back and use it later.
This example shows how to save properties of the device. I will be using light levels for this one.
Number Variable Example
- Open composer
- Click on System Design
- Click on My Drivers
- Under the Lighting Category double click on the Wireless Dimmer
- Under the User Interface Category double click on the 2-Button keypad
- Click on Agents
- Click on Variables
- Click on the New icon
- In the Variable Type drop down box select Number
- Enter in a meaningful name in the name field. I named this one savedLightLevel.
- Click on the Ok Button
- Click on the Programming
- Under the events tab select the 2-Button Keypad
- Select Button 1 and then select the pressed radio button.
- In the actions side click on the Variable you named earlier (in my example it is called savedLightLevel).
- Select the radio button Set to Value of and select ‘Room->Light->LIGHT_LEVEL’.
- Drag the arrow into the script.
- Under the events tab select the 2-Button Keypad
- Select Button 2 and then select the pressed radio button.
- In the actions side click on Light_LEVEL under the Light you added earlier
- Select the radio button Set to Value of and select ‘Variable->savedLightLevel’.
- Drag the arrow into the script.
All done!
Credit for this write-up goes to Alan Chow of Convergent Technologies from Austrailia. Thanks for contributing, Alan! If you’re visitng from “down under”, be sure to check out their website.
Tags: variables | Posted under How do I... | No Comments