Note: when a conditional below uses a # in it, it represents whatever channel number you wish to grab that value from.
din[#].state == 1
rout[#].state == 1
temp[#].f >= 75
or temp[#].fahrenheit >= 75
temp[#].c >= 20
or temp[#].celsius >= 20
env[#].f >= 75
or env[#].fahrenheit >= 75
env[#].c >= 20
or env[#].celsius >= 20
env[#].humidity >= 80
date.isDay(montuewedthufri)
date.isDay(satsun)
time.isBefore("HH:MM")
time.isAfter("HH:MM")
iin[#].scaled == 1
iout[#].scaled == 1
vin[#].scaled == 1
vout[#].scaled == 1
Using din[#].state == 1 and rout[#].state == 1 are for referencing if inputs and outputs of the JNIOR I/O are high or low. (1 being High, 0 being low) The example above shows an if block action checking if din[1].state == 1, which means the if block won't run unless Input 1 is High, and if it is, then pulse output 1 for 5 seconds.
Using the temperature and humidity taken from the environmental sensor, you can perform action based on those values. The example above shows a while block, and with a environmental sensor module hooked up to the JNIOR, you can have a task that will run a loop that logs the temperature until the temperature of the room drops to a certain number.
When performing actions, you can reference the day of the week to control when certain actions will perform. The example above shows two if statements, one setting output 1 to high if its Monday - Friday, and another setting output 2 to high if its Saturday or Sunday.
The registry can be modified using expression in a Task. There are two ways to interact with the Registry. You can read the registry for a value, and write to the registry to set a value to it. In the example above, a set variable action is use to set a variable called TcpPort to the current registry value for the cinema server Tcp. It does this using the registry.read("") function, entering in the registry directory of the registry you are trying to read. Then it checks if the TcpPort value we just made is set to 9600. If the TcpPort value is not 9600 it then uses the registry.write(" "," "), describes where in the registry to change the registry in the first value, entering 9600 in the second value to set 9600 in the registry key.
A random number can be generated when needed. The example above logs 40 randomly generated numbers, and shows two ways you can define a randomly generated number. The expression is started by using int.random() which is the function that generates the number. After that two different types of parameters can be entered. The first parameter is a number, and then the function will generate a random number between the zero and the one you entered. The other parameter is using two numbers, and then the function will generate a random number between the first number and the second number. Since we are logging the variables, when they are entered into the log action they are given double curly braces.
When performing actions, you can reference the time of day to control certain actions as well. The example above shows two if statements, setting output 1 to high for 5 seconds if its before 2:45pm, or setting output 2 to high for 5 seconds if its after 2:25pm. The time is based on 24 hours, so 11:59pm is 23:59.
The 10volt and 4-20ma expansion modules I/O can be used to control actions based off their values. The example above shows that if the 4-20ma output is greater then 10 then it sets itself back to 4, and if the 10volt goes above 5, then its sets itself to zero.