GrovePi v0.3.2 API Reference
Modules
This application lets you interact with the GrovePi+ and any connected sensors in Elixir. It will automatically start with your application an initiate a connection to the GrovePi+ board
Perform analog I/O using the GrovePi. Analog reads return 10-bit values (0-1023) from analog to digital converters on the GrovePi. These values map to voltages between 0 and 5 volts. Analog writes generate a steady square wave on supported pins (also called PWM). The connectors and pins on the GrovePi and GrovePiZero boards differ in their support for analog reads and writes
Low-level interface for sending raw requests and receiving responses from a GrovePi hat. Create one of these first and then use one of the other GrovePi modules for interacting with a connected sensor, light, or actuator
Listen for events from a GrovePi button. There are two types of
events by default; pressed and released. When registering for an event the
button will then send a message of {pin, :pressed, %{value: 1}
or
{pin, :released, %{value: 0}}
. The button works by polling
GrovePi.Digital
on the pin that you have registered to a button
This is the default triggering mechanism for Button events. Events
are either pressed
or released
and include the trigger state.
The trigger state for the default trigger is a struct containing
a value
property
Control a Grove buzzer. While a buzzer can be controlled solely using
GrovePi.Digital
, this module provides some helpers
Read temperature and humidity from the Grove DHT sensor
Listen for events from a GrovePi DHT (Digital Humidity and Temparature)
sensor. This module is configured for the DHT11, the blue one, that comes
with the GrovePi+ Starter Kit. There is only one type of event by default;
:changed
. When registering for an event the DHT11 will send a message in the
form of {pin, :changed, %{temp: 11.3, humidity: 45.5}
with the temp and
humidty being floats. The GrovePi.DHT11
module works by polling
the pin that you have registered to a DHT sensor
This is the default triggering mechanism for DHT11 events. The
event is :changed
and includes the trigger state. The trigger state
for the default trigger is a struct containing temp
and humidity
properties
Write to and read digital I/O on the GrovePi
Listen for events from a GrovePi potentiometer or rotary angle sensor. There
is only one type of event by default; :changed
. When registering for an
event the potentiometer will send a message similar to
{pin, :changed, {value: 1}
with the value being a number from 0-1023
that maps to 0 to 5 volts. The potentiometer works by polling
GrovePi.Analog
on the pin that you have registered to a potentiometer
This is the default triggering mechanism for Potentiometer events. The
event is :changed
and includes the trigger state. The trigger state
for the default trigger is a struct containing a value
property
Listen for events from a GrovePi sound module. There are two types of
events by default; loud and quiet. When registering for an event the sound
will then send a message of {pin, :loud, _trigger_date}
or
{pin, :quiet, _trigger_data}
. The sound works by polling
GrovePi.Analog
on the pin that you have registered to a sound
This is the default triggering mechanism for Sound events. Events
are either loud
or quiet
and include the trigger state. It
contains to thresholds a low_threshold
and a high_threshold
for
triggering loud
and quiet
events
This is the top level supervisor that is started by the grovepi application. You
can use this to start your own grovepi supervision tree by passing a prefix to the
start_link
function
The Trigger behaviour is used for implementing triggers for poller
behaviors such as GrovePi.Sound
and GrovePi.Button
. The triggers
must implement two callbacks, init and update
Read distance from the Grove Ultrasonic sensor