GrovePi v0.2.0 GrovePi.Button
Listen for events from a GrovePi button. There are two types of
events; pressed and released. When registering for an event the button
will then send a message of {pin, :pressed}
or {pin, :released}
.
The button works by polling GrovePi.Digital
on the pin that you have
registered to a button.
Example usage:
iex> {:ok, button}=GrovePi.Button.start_link(3)
:ok
iex> GrovePi.Button.subscribe(3, :pressed)
:ok
iex> GrovePi.Button.subscribe(3, :released)
:ok