Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
6aca8daf
Commit
6aca8daf
authored
Jan 30, 2015
by
Martin Han
Browse files
Print LUX Data Every 10s
parent
fb10825c
Changes
1
Show whitespace changes
Inline
Side-by-side
lua_modules/bh1750/bh1750_Example1.lua
0 → 100644
View file @
6aca8daf
-- ***************************************************************************
-- 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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment