Appendix G: BASIC Scripts
Let b = 5
Let d = b + 2
Predefined Variables
The following are useful predefined variables for the ControlByWeb™ BASIC interpreter. These are
useful for accessing internal values and features states.
Note: Some models may not contain digital inputs, analog inputs and/or relays and thus would not have
digital input, analog input and/or relay variables.
Timer Variables
Six timers are available for use in BASIC scripts. They are designated as t0 through t5. Timers can be
set to any positive integer (or 0) by using the LET statement. As soon as a value is assigned to a timer, it
will begin to count down immediately by decrementing one count every 100ms until it reaches zero.
Examples:
Let t3 = 1500
Let t1 = 0
Relay Variables
The relays can be turned ON, turned OFF, pulsed, toggled, or read in BASIC scripts. The LET statement
is used to set the relay state. The state options available are:
0 – turn relay off
1 – turn relay on
2 – pulse relay
5 – toggle relay
The pulse time is specified in the Relays setup tab. Relays are designated as relay1, relay2, etc., which
correspond to Relay 1, Relay 2, etc.
Examples:
Let relay1 = 1
Let relay2 = 0
Let relay1 = 2
Let relay2 = 5
Let a = relay2
Input Variables (WebRelay-10 Plus™ only)
The input states can be read in BASIC scripts. The inputs are designated as input1 and input2.
Example:
Let a = input1
Temperature/Humidity Sensor Variables (WebRelay-10 Plus™ only)
Each temperature sensor or humidity sensor can be read in BASIC scripts. The sensors are designated
as temp1, temp2 ... temp8
Example:
If temp2 >= 80 Then 'If temperature sensor reads greater than 80
Let relay2 = 1
End If
page 98
'variable b will be set to 5
'variable d will be set to 7
'set timer 3 to 150 seconds
'disable time 1
'turn on relay 1
'turn off relay 2
'pulse relay 1
'toggle relay 2
'read the state of relay 2, state will be 0 or 1
'sets 'a' equal to value of input 1
' degrees, then
'Turn on relay 2
WebRelay-10 Users Manual
Xytronix Research & Design, Inc.
Need help?
Do you have a question about the WebRelay-10 X-WR-10R12-I and is the answer not in the manual?
Questions and answers