Use BH1750 16-bit ambient light sensor in Elixir.
Add bh1750
to your list of dependencies in mix.exs
:
def deps do
[
{:bh1750, "~> 0.2"}
]
end
I2C address can be either 0x23
(default) or 0x5C
.
{:ok, sensor} = BH1750.start_link
{:ok, lux} = BH1750.measure(sensor)
For more information, see API reference.