GrovePi v0.6.1 GrovePi.Relay View Source

Conveniences for controlling a GrovePi Relay.

The relay should be connected to a Digital port (e.g. D3). The relay can be connected to something with a larger load, i.e appliance or desk lamp, which can then be controlled by the GrovePi.

iex> pin = 3
3
iex> GrovePi.Relay.initialize(pin)
:ok
iex> GrovePi.Relay.on(pin)
:ok
iex> GrovePi.Relay.off(pin)
:ok

Link to this section Summary

Functions

Sets the pin mode to output. Required prior to using on/1 or off/1

Turns off the appliance, lamp, etc. connected to the relay

Turns on the appliance, lamp, etc. connected to the relay

Link to this section Functions

Link to this function initialize(pin) View Source
initialize(GrovePi.pin()) :: :ok | {:error, term()}

Sets the pin mode to output. Required prior to using on/1 or off/1.

Link to this function off(pin) View Source
off(GrovePi.pin()) :: :ok | {:error, term()}

Turns off the appliance, lamp, etc. connected to the relay.

Link to this function on(pin) View Source
on(GrovePi.pin()) :: :ok | {:error, term()}

Turns on the appliance, lamp, etc. connected to the relay.