pyhoff.devices.KL2408#
- class pyhoff.devices.KL2408(bus_coupler, output_bit_addresses, input_bit_addresses, output_word_addresses, input_word_addresses, mixed_mapping)#
Bases:
DigitalOutputTerminal8Bit
750-530: 8x digital output with 24 V / 500 mA
Contact order for DO1 to DO8 is: 1, 5, 2, 6, 3, 7, 4, 8.
- read_coil(channel)#
Read the coil value back from a specific channel.
- Parameters:
channel (
int
) – The channel number (start counting from 1) to read from.- Return type:
bool
|None
- Returns:
The coil value of the specified channel or None if the read operation failed.
- Raises:
Exception – If the channel number is out of range.
- write_coil(channel, value)#
Write a value to a specific channel.
- Parameters:
channel (
int
) – The channel number (start counting from 1) to write to.value (
bool
) – The value to write.
- Return type:
bool
- Returns:
True if the write operation succeeded, otherwise False.
- Raises:
Exception – If the channel number is out of range.