InoDrive / IO / set_input_polarity


InoDrive.IO.set_input_polarity(self, target=None, state=None)

Set Polarity of Specific Input.

Arguments:

self (Object): Reference to IO Instance.
target (Integer or String): Module’s Input Range (0 to 3) or 'all'.
state (String): Input Polarity state, 'PNP' or 'NPN'.

Returns: Boolean – True or None on successfully setting Input Polarity.

import CkInoDriveAPI

# Instantiate InoDrive Object and Connect by Name
Drive = CkInoDriveAPI.InoDrive(target='Name', autoConnect=True)

# Take Control of InoDrive to Override Input Polarity
result = Drive.SysControl.take_control(True)

# Set Input 0’s Polarity to PNP
result = Drive.IO.set_input_polarity(0, 'PNP')

if result:
    polarity = Drive.IO.get_input_polarity(0)
    print(f"Input 0's Polarity is set to {polarity}")

# Set all Input's Polarity to NPN
result = Drive.IO.set_input_polarity('all', 'NPN')