AFL.automation.loading.LabJackRelay#

Functions

bitmask_to_dict(bitmask, keys)

Converts a boolean bitmask into a dictionary of booleans.

Classes

LabJackRelay(relaylabels[, devicetype, ...])

MultiChannelRelay()

class AFL.automation.loading.LabJackRelay.LabJackRelay(relaylabels, devicetype='ANY', connection='ANY', deviceident='ANY', shared_device=None)[source]#
__init__(relaylabels, devicetype='ANY', connection='ANY', deviceident='ANY', shared_device=None)[source]#

Init connection to a labeled Labjack RB12 Relay module.

Params: relaylabels (dict):

mapping of port id to load name, e.g. {0:’arm_up’,1:’arm_down’}

board_id (int, default 0):

board ID to connect to, set via jumpers on the board.

setAllChannelsOff()[source]#
setChannels(channels, verify=True)[source]#

Write a value (True, False) to the channels specified in channels

Parameters: channels (dict):

dict of channels, keys as either str (name) or int (id) to write to, vals as the value to write

getChannels(asid=False)[source]#

Read the current state of all channels

Parameters: asid (bool,default false): Dict keys should simply be the id, not the name.

Returns: (dict) key:value mappings of state.

toggleChannels(channels)[source]#
AFL.automation.loading.LabJackRelay.bitmask_to_dict(bitmask, keys)[source]#

Converts a boolean bitmask into a dictionary of booleans.

Parameters:
  • bitmask – Integer bitmask

  • keys – List of keys corresponding to each bit position

Returns:

Dictionary with keys mapped to boolean values