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
relation
parameter 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 >= |
auto_sync
set_doSet 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)
auto_sync
wait_diWait 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, "=")
auto_sync
set_aoSet 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)
auto_sync
wait_aiWait 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)