Arb (arb v0.7.0-rc.1) View Source
A NIF for controlling the ABACOM CH341A relay board.
Link to this section Summary
Functions
Given a list of ids turns on the corresponding relays. An empty list turns off all relays.
Returns the ids of active relays.
Resets the relay board.
Link to this section Functions
Specs
Given a list of ids turns on the corresponding relays. An empty list turns off all relays.
The relays are labeled from 1 to 8 according to the data sheet.
Options
The accepted options are:
:verify
– configures whether the activation should be verfied (default: true):port
– configures which USB port to use. Only necessary if multiple relay boards are connected (default: nil)
Examples
iex> Arb.activate([1, 4, 7])
:ok
Specs
Returns the ids of active relays.
Examples
iex> Arb.get_active()
{:ok, [1, 3, 6]}
Specs
Resets the relay board.
If, under some circumstances, relay board operations fail due to a USB error
e.g. {:error, {:usb, "Input/Output Error"}}
, this function may resolve
the issue by reseting the relay board. The effect is similar to replugging
the device.
Note: Previously activated relays stay active.
Examples
iex> Arb.reset()
:ok