Update README.md
This commit is contained in:
parent
9f7a2554f5
commit
be93fe5e14
|
@ -1,24 +1,24 @@
|
||||||
HDC1000 NodeMCU Library
|
HDC1000 NodeMCU module
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
Here's my NodeMCU library for the TI HDC1000 temperature and humidity sensor. It should work with the HDC1008 too but I haven't tested it.
|
Here's my NodeMCU module for the TI HDC1000 temperature and humidity sensor. It should work with the HDC1008 too but I haven't tested it.
|
||||||
|
|
||||||
### Setup your sensor:
|
### Setup your sensor:
|
||||||
First, require it:
|
First, require it:
|
||||||
|
|
||||||
`hdc1000 = require("hdc1000")`
|
`HDC1000 = require("HDC1000")`
|
||||||
|
|
||||||
Then, initialize it:
|
Then, initialize it:
|
||||||
|
|
||||||
`hdc1000.init(sda, scl)`
|
`HDC1000.init(sda, scl)`
|
||||||
|
|
||||||
Configure it:
|
Configure it:
|
||||||
|
|
||||||
`hdc1000.config()`
|
`HDC1000.config()`
|
||||||
|
|
||||||
Default options set the address to 0x40 and enable both temperature and humidity readings at 14-bit resolution, with the integrated heater on. You can change them by initializing your sensor like this:
|
Default options set the address to 0x40 and enable both temperature and humidity readings at 14-bit resolution, with the integrated heater on. You can change them by initializing your sensor like this:
|
||||||
|
|
||||||
`mySensor.begin(address, resolution, heater);`
|
`HDC1000.config(address, resolution, heater);`
|
||||||
|
|
||||||
"resolution" can be set to 14 bits for both temperature and humidity (0x00 - default) 11 bits for temperature (0x40), 11 bits for humidity (0x01), 8 bits for humidity (0x20)
|
"resolution" can be set to 14 bits for both temperature and humidity (0x00 - default) 11 bits for temperature (0x40), 11 bits for humidity (0x01), 8 bits for humidity (0x20)
|
||||||
"heater" can be set to ON (0x20 - default) or OFF (0x00)
|
"heater" can be set to ON (0x20 - default) or OFF (0x00)
|
||||||
|
@ -26,14 +26,14 @@ Default options set the address to 0x40 and enable both temperature and humidity
|
||||||
### Read some values
|
### Read some values
|
||||||
You can read temperature and humidity by using the following commands:
|
You can read temperature and humidity by using the following commands:
|
||||||
|
|
||||||
`temperature = hdc1000.getTemp()` in Celsius degrees.
|
`temperature = HDC1000.getTemp()` in Celsius degrees.
|
||||||
|
|
||||||
`humidity = hdc1000.getHumi()` in %
|
`humidity = HDC1000.getHumi()` in %
|
||||||
|
|
||||||
### Check your battery
|
### Check your battery
|
||||||
|
|
||||||
The following code returns true if the battery voltage is <2.8V, false otherwise.
|
The following code returns true if the battery voltage is <2.8V, false otherwise.
|
||||||
|
|
||||||
`isDead = hdc1000.batteryDead();`
|
`isDead = HDC1000.batteryDead();`
|
||||||
|
|
||||||
Happy making! Also, check out my Breakout Board and Arduino library for this chip: http://b.truzzi.me/hdc1000-temperature-and-humidity-sensor-breakout-with-arduino-library/.
|
Happy making! Also, check out my Breakout Board and Arduino library for this chip: http://b.truzzi.me/hdc1000-temperature-and-humidity-sensor-breakout-with-arduino-library/.
|
||||||
|
|
Loading…
Reference in New Issue