View Source Arb (arb v0.8.0)
A NIF for controlling the ABACOM CH341A relay board.
Link to this section Summary
Types
The relays are labeled from 1 to 8 according to the data sheet.
Functions
Activates the relays that correspond to the given a list of IDs. An empty list deactivates all relays.
Returns the ids of active relays.
Resets the relay board.
Link to this section Types
Specs
relay_id() :: 1..8
The relays are labeled from 1 to 8 according to the data sheet.
Link to this section Functions
Specs
Activates the relays that correspond to the given a list of IDs. An empty list deactivates all relays.
options
Options
:port
- The USB port to be used. Only necessary if multiple relay boards are connected.:verify
- Configures whether the activation should be verified. The default value istrue
.
examples
Examples
iex> Arb.activate([1, 4, 7])
:ok
Specs
Returns the ids of active relays.
options
Options
:port
- The USB port to be used. Only necessary if multiple relay boards are connected.
examples
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.
options
Options
:port
- The USB port to be used. Only necessary if multiple relay boards are connected.
examples
Examples
iex> Arb.reset()
:ok