mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-30 21:12:55 +08:00
6926c66b16
* Add missing globals from luacheck config * Fix luacheck warnings in all lua files * Re-enable luacheck in Travis * Speed up Travis by using preinstalled LuaRocks * Fix more luacheck warnings in httpserver lua module * Fix DCC module and add appropriate definitions to luacheck config. * Change inline comments from ignoring block to only ignore specific line * Add Luacheck for Windows and enable it for both Windows and Linux * Change luacheck exceptions and fix errors from 1st round of polishing * Add retry and timeout params to wget
23 lines
627 B
Lua
23 lines
627 B
Lua
-- ***************************************************************************
|
|
-- BH1750 Example Program for ESP8266 with nodeMCU
|
|
-- BH1750 compatible tested 2015-1-30
|
|
--
|
|
-- Written by xiaohu
|
|
--
|
|
-- MIT license, http://opensource.org/licenses/MIT
|
|
-- ***************************************************************************
|
|
local bh1750 = require("bh1750")
|
|
|
|
local sda = 6 -- sda pin, GPIO12
|
|
local scl = 5 -- scl pin, GPIO14
|
|
|
|
do
|
|
bh1750.init(sda, scl)
|
|
|
|
tmr.create():alarm(10000, tmr.ALARM_AUTO, function()
|
|
bh1750.read()
|
|
local l = bh1750.getlux()
|
|
print("lux: "..(l / 100).."."..(l % 100).." lx")
|
|
end)
|
|
end
|