
18
5.4 - Reviewing the Script Wizard Code
The following script will be generated. The button 1 & 2 actions simply drive the LIOs and LEDs
corresponding to the buttons. A periodic timer drives the button 1 & 2 LEDs with the value read
from the LIO corresponding to those buttons. The button 3 & 4 actions simply drive the LIOs and
LEDs corresponding to the buttons.
//AG_START//AG_START
// All code between the AG_START and AG_END tags is auto
// generated and should not be modified.
// Script Generator GUI V1.1.1
//AG_BTN1 TYPE="LIO_MOMENTARY" LED="1"
//AG_BTN2 TYPE="LIO_MOMENTARY" LED="1"
//AG_BTN3 TYPE="LIO_MOMENTARY" LED="0"
//AG_BTN4 TYPE="LIO_MOMENTARY" LED="0"
variable: AG_scratch // Temporary scratch pad variable for AG actions.
action: STARTUP
{
AG_scratch = tmr_create_periodic (3, "AG_TIMER_FUNC")
}
action: AG_TIMER_FUNC //LIO 1 and 2
{
btn_led (1, lio_get (1)) // get LIO 1 value and light LED1 (ON) if true
btn_led (2, lio_get (2)) //get LIO 2 value and light LED2 (OFF) if true
}
The auto-generated script code for the first two buttons will assert the input LIO while the button
is pressed and de-assert the input LIO when the button is released. The button LED will light
from the results of the periodic timer query in section above..
action: BTN_1_PRESS //mapped as REMOTE ON in Device Properties
{
lio_set (1,1)
}
action: BTN_1_RELEASE
{
lio_set (1,0)
}
action: BTN_2_PRESS //mapped as REMOTE OFF in Device Properties
{
lio_set (2,1)
}
action: BTN_2_RELEASE
{
lio_set (2,0)
}