GrovePi v0.6.1 GrovePi.Digital View Source
Write to and read digital I/O on the GrovePi. This module provides a low level API to digital sensors.
Example usage:
iex> pin = 3
iex> GrovePi.Digital.set_pin_mode(pin, :input)
:ok
iex> GrovePi.Digital.read(pin, 0)
1
iex> GrovePi.Digital.set_pin_mode(pin, :output)
:ok
iex> GrovePi.Digital.write(pin, 1)
:ok
iex> GrovePi.Digital.write(pin, 0)
:ok
Link to this section Summary
Functions
Read the value on a digital I/O pin. Before this is called, the pin must be
configured as an :input with set_pin_mode/2 or set_pin_mode/3
Configure a digital I/O pin to be an :input or an :output
Write a value on a digital I/O pin. Before this is called, the pin must be
configured as an :output with set_pin_mode/2 or set_pin_mode/3. Valid
values are 0 (low) and 1 (high)
Link to this section Types
Link to this section Functions
Read the value on a digital I/O pin. Before this is called, the pin must be
configured as an :input with set_pin_mode/2 or set_pin_mode/3.
read(atom(), GrovePi.pin()) :: level() | {:error, term()}
set_pin_mode(GrovePi.pin(), pin_mode()) :: :ok | {:error, term()}
Configure a digital I/O pin to be an :input or an :output.
set_pin_mode(atom(), GrovePi.pin(), pin_mode()) :: :ok | {:error, term()}
write(GrovePi.pin(), level()) :: :ok | {:error, term()}
Write a value on a digital I/O pin. Before this is called, the pin must be
configured as an :output with set_pin_mode/2 or set_pin_mode/3. Valid
values are 0 (low) and 1 (high).
write(atom(), GrovePi.pin(), level()) :: :ok | {:error, term()}