XW-210 WiFi™ Users Manual
4.9.1 Example Script
The following is an example script which monitors a door switch. An alarm sounds after a door has been
open for 10 seconds and turns off if the door is closed. It includes a trigger to exit the timer if the input
turns off before 10 seconds has elapsed. This helps insure that the alarm will only turn on if the door has
been open for 10 seconds.
'This example will turn on a relay after an input has been on for 10 seconds
LET relay1 = 0
'Make sure the relay is off when the script starts
DO
'Begin main program loop
IF input1 = 1 THEN
'Checks if input 1 is on - Door is open
CALL delay
'Calls the delay function
IF input1 = 1 THEN
'After the delay is done, it will check the door again
LET relay1 = 1
'Turns the relay on, sounding the alarm
END IF
ELSE
'If input1 is off - door is closed
LET relay1 = 0
'Turn relay1/alarm off after closed door
END IF
'End of IF input1 = 1
LOOP
'Loop main program
END
'End main program loop
SUB delay
'SUB function
LET t1 = 100
'Set timer = 10.0 seconds
DO WHILE t1 > 0
'Loop while timer is counting down to 0.0 seconds
IF input1 = 0 THEN
'If the input turns off (door closed), exit loop
LET t1 = 0
'Sets timer to 0 to exit loop
END IF
'End of IF input1 = 0
LOOP
'Loop the DO WHILE statement above
END SUB
'End of the SUB routine
Xytronix Research & Design, Inc.
Page 51
Summary of Contents for WebRelay Wireless XW-210I
Page 1: ......