12-02-2022, 11:03 AM
You can simply override the setDO function inside your RobotPost class by using a function like the one below.
I attached the post processor I believe you need.
I attached the post processor I believe you need.
Code:
class RobotPost(BasePost):
def setDO(self, io_var, io_value):
"""Set a Digital Output"""
if type(io_var) != str: # set default variable name if io_var is a number
io_var = 'DO_%02i' % io_var
if type(io_value) != str: # set default variable value if io_value is a number
if io_value > 0:
io_value = '1'
else:
io_value = '0'
# at this point, io_var and io_value must be string values
self.addline('SetDO %s, %s;' % (io_var, io_value))