NodeMCU Lua AM2315 temperature and humidity sensor
Lua
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
am2315.lua

README.md

am2315-lua

NodeMCU Lua AM2315 temperature and humidity sensor

##Require

am2315 = require("am2315")

Release

am2315 = nil
package.loaded["am2315"]=nil

##Example ####Description getting temperature and humidity data from am2315.

####Syntax am2315.getData()

####init Parameters sda: 112, IO index.
scl: 1
12, IO index.
addr: i2c address (default 0x5c).

am2315 = require("am2315")
gpio0 = 4
gpio2 = 3
sda = gpio0
scl = gpio2
am2315.init(sda, scl)

-- Get temperature and humidity.
t,h = am2315.getData()
print(t, h)

-- Don't forget to release it after use
am2315 = nil
package.loaded["am2315"]=nil