Commit 6aca8daf authored by Martin Han's avatar Martin Han
Browse files

Print LUX Data Every 10s

parent fb10825c
-- ***************************************************************************
-- BH1750 Example Program for ESP8266 with nodeMCU
-- BH1750 compatible tested 2015-1-30
--
-- Written by xiaohu
--
-- MIT license, http://opensource.org/licenses/MIT
-- ***************************************************************************
tmr.alarm(0, 10000, 1, function()
SDA_PIN = 6 -- sda pin, GPIO12
SCL_PIN = 5 -- scl pin, GPIO14
bh1750 = require("bh1750")
bh1750.init(SDA_PIN, SCL_PIN)
bh1750.read(OSS)
l = bh1750.getlux()
print("lux: "..(l / 100).."."..(l % 100).." lx")
-- release module
bh1750 = nil
package.loaded["bh1750"]=nil
end)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment