set_digital_output(index, val=None, time=None, val2=None)
Features
This function sends a signal at the digital contact point of the controller. A value saved in the digital output register is output as a digital signal. After sending out the specified signal for the set time, the next signal is sent out.
Parameters
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
index | int | - | I/O contact number mounted on the controller
(A positive number means ON while a negative number means OFF.) |
val | int | - | I/O value
|
time | float | - | Time(0.01 ~ 3,000,000) |
val2 | int | - | I/O value
|
Note
If val is omitted, the positive number becomes ON and the negative number OFF according to the sign of the argument index.
Return
Value | Description |
---|---|
0 | Success |
Negative value | Failed |
Exception
Exception | Description |
---|---|
DR_Error (DR_ERROR_TYPE) | Parameter data type error occurred |
DR_Error (DR_ERROR_VALUE) | Parameter value is invalid |
DR_Error (DR_ERROR_RUNTIME) | C extension module error occurred |
DR_Error (DR_ERROR_STOP) | Program terminated forcefully |
Example
set_digital_output(1, ON, 2.0, OFF) # No. 1 contact ON, OFF after 2 seconds
set_digital_output(5, OFF, 0.5, OFF) # No. 16 contact OFF, ON after 0.5 seconds