Breadcrumbs

set_digital_output(index, val =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.

Parameters

Parameter Name

Data Type

Default Value

Description

index

int

-

I/O contact number mounted on the controller

  • Val argument existing: A number between 1 and 16

  • No val argument: 1 ~ 16 , -1 ~ -16

(A positive number means ON while a negative number means OFF.)

val

int

-

I/O value

  • ON: 1

  • OFF: 0


If val is omitted, positive numbers become ON and negative numbers become OFF depending on the sign (+/-) of the 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

Python
set_digital_output(1, ON)	        # No. 1 contact ON
set_digital_output(16, OFF)	# No. 16 contact OFF
set_digital_output(3)		#No. 3 contact ON (A positive number means ON if the argument val is omitted.)  
set_digital_output(-3)		#No. 3 contact OFF (A negative number means OFF if the argument val is omitted.)