Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
b3ae9d14
Commit
b3ae9d14
authored
Dec 05, 2015
by
Vowstar
Committed by
Nick Andrew
Dec 06, 2015
Browse files
Add DHT sensor lib description in ReadMe
A lot of people don't know DHT sensor lib.
parent
844f85be
Changes
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
b3ae9d14
...
...
@@ -638,3 +638,31 @@ The HX711 is an inexpensive 24bit ADC with programmable 128x, 64x, and 32x gain.
-- Read ch A with 128 gain.
raw_data
=
hx711
.
read
(
0
)
```
####Universal DHT Sensor support
Support DHT11, DHT21, DHT22, DHT33, DHT44, etc.
Use all-in-one function to read DHT sensor.
```
lua
pin
=
5
status
,
temp
,
humi
,
temp_decimial
,
humi_decimial
=
dht
.
readxx
(
pin
)
if
(
status
==
dht
.
OK
)
then
-- Integer firmware using this example
print
(
string.format
(
"DHT Temperature:%d.%03d;Humidity:%d.%03d\r\n"
,
math.floor
(
temp
),
temp_decimial
,
math.floor
(
humi
),
humi_decimial
)
)
-- Float firmware using this example
print
(
"DHT Temperature:"
..
temp
..
";"
..
"Humidity:"
..
humi
)
elseif
(
status
==
dht
.
ERROR_CHECKSUM
)
then
print
(
"DHT Checksum error."
);
elseif
(
status
==
dht
.
ERROR_TIMEOUT
)
then
print
(
"DHT Time out."
);
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