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
4f330e45
Commit
4f330e45
authored
Jan 17, 2016
by
Marcel Stör
Browse files
Merge pull request #946 from SebastianSchildt/fixds18b20
Fix unit constants to be consistent with code
parents
56458275
0863a4c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
lua_modules/ds18b20/ds18b20-example.lua
View file @
4f330e45
...
...
@@ -13,6 +13,14 @@ end
-- Just read temperature
print
(
"Temperature: "
..
t
.
read
()
..
"'C"
)
-- Get temperature of first detected sensor in Fahrenheit
print
(
"Temperature: "
..
t
.
read
(
nil
,
t
.
F
)
..
"'F"
)
-- Query the second detected sensor, get temperature in Kelvin
if
(
table
.
getn
(
addrs
)
>=
2
)
then
print
(
"Second sensor: "
..
t
.
read
(
addrs
[
2
],
t
.
K
)
..
"'K"
)
end
-- Don't forget to release it after use
t
=
nil
ds18b20
=
nil
...
...
lua_modules/ds18b20/ds18b20.lua
View file @
4f330e45
...
...
@@ -33,9 +33,9 @@ setfenv(1,M)
--------------------------------------------------------------------------------
-- Implementation
--------------------------------------------------------------------------------
C
=
0
F
=
1
K
=
2
C
=
'C'
F
=
'F'
K
=
'K'
function
setup
(
dq
)
pin
=
dq
if
(
pin
==
nil
)
then
...
...
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