Auxiliary Operations
XW-210 WiFi™ Users Manual
Example:
Do
If register1 = 1 Then
Let rmt_relay1 = 1
Else
Let rmt_relay1 = 0
End If
Call delay
Loop
End
SUB delay
Let t1 = 10
Do While t1 > 0
Loop
End Sub
Registers can also be used to show numeric values, such as a count down timer. If the register is any
other value than 1 or 0, the value will be displayed in the Status 2 column. See Section 4.11:
Control
Page Setup
for instructions on configuring Registers for visibility on the
Control Page
.
The following code will show a count down from 10 seconds and automatically restart. The refresh rate
for the control page is set to 3 seconds, so the countdown may appear to jump.
Example:
let t0 = 10
'Initialize variables and start timer
let register1 = 10
'Main Loop
Do
if t0 = 0
'when timer reaches 0 decrement counter
let register1 = register1 - 1
let t0 = 10
end if
if register1 < 0
'restart when counter reaches zero
let register1 = 10
end if
loop
end
register1 can be set and cleared by entering the following requests into a web browser or by configuring
on and off buttons to appear on the
Control Page
for register1:
http://192.168.1.2/state.xml?register1=1
http://192.168.1.2/state.xml?register1=0
6.7.7 Testing and Debugging
A copy of the BASIC interpreter for Windows is available on www.controlbyweb.com for testing and
debugging. The XW-210 will only acknowledge errors as it runs. This means that if a path of the script is
not encountered, errors may still exist. The Windows version of the interpreter, however, will check for
errors before the script is run.
The PRINT function is available for use with the Windows version of the BASIC interpreter. The
interpreter on the device, however, will not recognize this command.
Note: The script will be restarted by submitting any of the setup pages or by power cycling the unit.
The “MISSING END OF LINE” error may be caused by misspelled names or a program that is too long.
4096 bytes of memory is reserved for BASIC scripts. Each text character, space, punctuation mark, tab,
or carriage return uses one byte. If the script is too long, the script will be truncated and will not function
as desired.
Page 82
Xytronix Research & Design, Inc.
Содержание WebRelay Wireless XW-210I
Страница 1: ......