def setIo(self, channel, value): """Write the value of one analog output channel. This method calls the SetIo function of the module and writes the value of the analog output channel. Args: channel: IO channel number. Must be in the range 0 ... 3 value: Value object. Must be either ValueVOS4, ValueVOS2, ValueCUS4 or ValueANU2 Returns: IO_RETURN_OK in case of success, otherwise detailed IoReturn error code. Raises: TypeError: Passed argument types are wrong ValueError: Channel value is out of range """ if not isinstance(channel, int): raise TypeError('Expected channel as int, got %s' % (type(channel))) if not isinstance(value, (ValueANU2, ValueVOS2, ValueVOS4, ValueCUS4)): raise TypeError('Expected value as ValueANU2 or ValueVOS2, \ ValueVOS4 or ValueCUS4 got %s' % (type(value))) if (channel >= self.nrOfChannels): raise ValueError('Channel out of range') cmd = Cmd(self.com) return cmd.setIo(channel, value)
def setIo(self, channel, value): """Write the value or state of one digital output channel. This method calls the SetIo function of the module and writes the value or state of the digital output channel. Args: channel: IO channel number. Must be in the range 0 ... 3 value: Digital value object of type ValueDI1, initialized with the updated data. Returns: IO_RETURN_OK in case of success, otherwise detailed IoReturn error code. Raises: TypeError: Passed argument types are wrong ValueError: Channel value is out of range """ if not isinstance(channel, int): raise TypeError('Expected channel as int, got %s' % (type(channel))) if not isinstance(value, ValueDI1): raise TypeError('Expected value as ValueDI1, got %s' % (type(value))) if (channel >= self.nrOfChannels): raise ValueError('Channel out of range') cmd = Cmd(self.com) return cmd.setIo(channel, value)