Relay

class brainstem.entity.Relay(module, index)[source]

The RelayClass is the interface to relay entities on BrainStem modules.

Relay entities may be enabled (set) or disabled (cleared low). Other capabilities may be available, please see the product datasheet.

Useful Constants:
  • VALUE_LOW (0)

  • VALUE_HIGH (1)

getEnable()[source]

Get the relay enable state.

A return of 1 indicates the relay is enabled. A return of 0 indicates the relay is disabled.

Returns:

Result object, containing NO_ERROR and digital state

or a non zero Error code.

Return type:

Result

getVoltage()[source]

Get the scaled micro volt value with refrence to ground.

Get a 32 bit signed integer (in micro Volts) based on the boards ground and refrence voltages.

Note

Not all modules provide 32 bits of accuracy; Refer to the module’s datasheet to determine the analog bit depth and reference voltage.

Returns:

Result object, containing NO_ERROR and microVolts value

or a non zero Error code.

Return type:

Result

setEnable(bEnable)[source]

Enables or disables the relay based on bEnable.

Param:

bEnable (int): Set 1 for enable, set 0 for disable.

Returns:

Return NO_ERROR on success, or one of the common sets of return error codes on failure.

Return type:

Result.error