Control Box I/O
The control box has 4DI/4DO/2AI/2AO. For details on the interface correspondence, please refer to the User Manual.
Relational Judgment Operators
- The
relationparameter that appears in the interface is generally used to compare the relationship between the actual acquired value and the given value. The available relationships are as follows:
| Relation | Notation | Description |
|---|---|---|
| Equal | eq == = | Analog quantities have precision errors |
| Not Equal | neq ne != <> ~= | Analog quantities have precision errors |
| Less Than | lt < | |
| Less Than or Equal | lte <= | |
| Greater Than | gt > | |
| Greater Than or Equal | gte >= |
set_do auto_sync
Set digital output (control box).
set_do(pin, value)
- Parameters
pin: Port, starting from 0.value: Value to be set, 0 for off / 1 for on.
Compatibility Note
In version 2.2 and earlier, the command was written as:
set_dio(pin, value)
get_di
Get digital input (control box).
get_di(pin)
- Parameters
pin: Port, starting from 0.
Compatibility Note
In version 2.2 and earlier, the command was written as:
get_dio(pin)
wait_di auto_sync
Wait for digital input (control box).
wait_di(pin, value, relation)
Blocking wait for the input value of the specified port to meet the specified condition, polling every 10ms.
- Parameters
pin: Port, starting from 0.value: Value to be compared.relation: Relational judgment operator.
Example Program
- Wait until DI1 is in high level state.
wait_di(1, 1, "=")
set_ao auto_sync
Set analog output (control box).
set_aio(pin, value)
- Parameters
pin: Port, starting from 0.value: Value to be set, specify voltage or current value according to the output type.
Example Program
- Set AO0 output to 3V.
set_ao(0, 3)
Compatibility Note
In version 2.2 and earlier, the command was written as:
set_dio(pin, value)
get_ai
Get analog input (control box).
get_ai(pin)
- Parameters
pin: Port, starting from 0.
Example Program
local ai0 = get_ai(0)
print(ai0)
Possible output:
3.3
Compatibility Note
In version 2.2 and earlier, the command was written as:
get_aio(pin)
wait_ai auto_sync
Wait for analog input (control box).
wait_ai(pin, value, relation)
- Parameters
pin: Port, starting from 0.value: Value to be compared.relation: Relational judgment operator.
Example Program
- Wait until the voltage of AI1 is less than or equal to 4 V.
wait_ai(1, 4.0, "<=")
Compatibility Note
In version 2.2 and earlier, the command was written as:
wait_aio(pin, value, relation)
