MhZ19 (mh_z19 v0.1.0) View Source
A Elixir library to retrieve CO2 concentration value from MH-Z19 sensor.
Installation
If available in Hex, the package can be installed
by adding mh_z19 to your list of dependencies in mix.exs:
def deps do
[
{:mh_z19, "~> 0.1.0"}
]
endUsage
iex> {:ok, pid} = MhZ19.start_link
{:ok, #PID<0.1104.0>}
iex> {:ok, result} = MhZ19.measure(pid)
{:ok, %{co2_concentration: 650}}References
- Intelligent Infrared CO2 Module (Model: MH-Z19) User’s Manual (Version: 1.0)
- Elixir × Nerves で MH-Z19 を動かす (in Japanese)
- mh-z19 · PyPI
Author
Kentaro Kuribayashi
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Initializes a GenServer process with given opts.
Retrieves the current CO2 concentration value.
Starts a GenServer process with given opts.
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Initializes a GenServer process with given opts.
Options
:tty- (String) Set the name of the serial device. Defaults tottyAMA0.
Retrieves the current CO2 concentration value.
Examples
iex> {:ok, result} = MhZ19.measure(pid)
{:ok, %{co2_concentration: 650}}
Starts a GenServer process with given opts.
Options
:name- (Atom) Set the name of the GenServer process. Defaults toMhZ19.
Examples
iex> {:ok, pid} = MhZ19.start_link