54 Commits

Author SHA1 Message Date
6332774b18 removed double conversion to Celsius 2019-04-17 20:01:26 +02:00
f566d58f47 Move ESP8266 yield() out of InterruptLock 2019-02-18 10:20:28 -08:00
7cec0cb06d Configurable pullup delay time, default 55 usec 2019-02-14 09:24:17 -08:00
8b9624479e removed '*' copy error. 2019-02-11 12:33:06 +01:00
57fe95c1be split off the DHT11 conversion, corrected the algorithm for temperatures below 0 degrees celsius. 2019-02-08 22:18:10 +01:00
d6488c1fbe Change initial HIGH delay, fix comments in examples 2019-01-28 17:05:54 -08:00
01490aa8de Vary delay by sensor type a la PR #70 2019-01-11 17:24:16 -08:00
bdd2756ed1 Fix computeHeatIndex declaration, check F_CPU in expectPulse 2019-01-11 16:47:34 -08:00
07da1cd001 Merge pull request #91 from chelmi/master
Fix for slower boards. Use uint16_t in expectPulse loop to increase sampling rate
2019-01-11 16:41:47 -08:00
b3b0b08d6d Merge pull request #115 from owenduffy/master
Fix timing and pin mode change to comply with datasheet.
2019-01-11 16:34:29 -08:00
bf86a4068c Merge pull request #112 from SConaway/patch-1
Read Temp and Humidity if not specified
2019-01-11 16:33:11 -08:00
f8d3497fac "Better Debug Information" via Driver55 PR #110 2019-01-11 16:31:02 -08:00
efcca31a7f Merge pull request #108 from qub1750ul/master
Use bool instead of boolean
2019-01-11 16:23:45 -08:00
fa129747e8 Merge pull request #95 from fanthos/master
Add support for DHT12.
2019-01-11 16:22:00 -08:00
dff65098bb Merge pull request #82 from adams13x13/patch-1
Fixes #81 Distinguish "signal already there" from "timeout"
2019-01-11 16:18:37 -08:00
73409c143c Merge pull request #76 from terryjmyers/patch-1
Modified read speed
2019-01-11 16:15:14 -08:00
5550a040c2 Merge pull request #61 from 7eggert/master
Save 66 bytes by using integer arithmetric
2019-01-11 16:05:29 -08:00
dc71b006b6 Merge pull request #52 from Spacefish/master
Use MIN_INTERVAL define instead of hardcoded value
2019-01-11 16:02:07 -08:00
b429942ce8 Fix timing and pin mode change to comply with datasheet. 2018-09-24 06:20:01 +10:00
2dfa77993d Update DHT.cpp 2018-07-30 11:31:34 -07:00
6b8b1ccdb9 Update DHT.cpp 2018-07-30 11:23:35 -07:00
3bba771f8c Changed boolean to bool 2018-06-27 19:18:17 +02:00
a607a50475 Add support for DHT12.
Change DHT11 temperature resolution to 0.1 instead of 1.
2017-12-12 14:20:26 +08:00
b07db5af21 Fix for slower boards. Use uint16_t in expectPulse loop to increase sampling rate and avoid bad readings.
Tested on atmega328 @ 8MHz and Feather M0 @ 48MHz
2017-11-02 22:53:50 -04:00
761f4f4fb9 Fixes #81 "signal already there" != "timeout"
If expectPulse(LOW) sees the port is already LOW (result == 0), this is not timeout!
2017-09-02 20:15:19 +02:00
16e61f1084 Modified read speed
Reduced delay times from 250ms and 20ms to 1ms.  This was done in accordance with the datasheet.  E.G. no where does it say you need to wait 250ms or 20ms.  It does say to set the line high for a minimum of 1ms (the second delay).  This has been tested and is working in my of my projects
2017-04-09 19:35:04 -04:00
519393f42e Save 66 bytes by using integer arithmetric 2016-09-08 17:11:29 +02:00
cad6977ba8 fix initilization of _lastreadtime 2015-12-27 02:47:09 +01:00
53375d8d70 Use MIN_INTERVAL define instead of hardcoded value 2015-12-26 22:32:34 +01:00
89937d5d25 mod readHumidity(). using parameter 'force' 2015-11-29 22:27:43 +09:00
15020aa891 Fix #44 by conditionally excluding unused port and bitmask state on non-AVR platforms. 2015-10-12 21:30:01 -07:00
ce3190f65c Switch back to integer division in array indexing. 2015-10-12 18:37:54 -07:00
5bc0a5c796 Divisions turned into multiplications
As correctly stated by Mausy5043, the division is quite slow in most
microcontrollers, so I have replaced them with multiplications.
2015-10-06 23:42:19 +01:00
51a8b814ac Divisions have been replaced by multiplications. 2015-10-03 13:42:09 +01:00
36fb16274b DHT::computeHeatIndex has been modified so it uses both Rothfusz and
Steadman's equations. As a result, it allows a larger range of
temperatures and more accurate results for extreme conditions.
2015-10-02 21:50:43 +01:00
f9c3f323e3 Use INPUT_PULLUP
Previously, the mode was configured to INPUT and then written HIGH,
which works on AVR but isn't very portable. Instead, this uses the
INPUT_PULLUP pin mode (available since Arduino 1.0.1) which is portable.
2015-07-24 21:44:41 +02:00
5973929e63 Remove the firstreading variable
By cleverly setting _lastreadtime in begin() to make sure that it looks
like the last read was alrady 2000 ms ago, even on startup when millis()
still returns 0, there is no longer a need to keep a separate
firstreading variable, saving a byte of memory and a bit of code.
2015-07-24 21:42:58 +02:00
f1b79028ea Clean up two-second interval check
There was some handling of millis() overflow that is not needed.
Standard unsigned subtraction and wraparound already works as expected,
so this extra check can be removed (it even hurts, since it introduces 2
seconds after a wraparound where no new data will be read, even if it
could otherwise happen).

Also, this prevents calling millis() a second time, since its value is
already known.
2015-07-24 21:41:19 +02:00
04905bc5cd Add force parameter to read methods
This allows forcing a read, even if the previous read was less than 2
seconds ago. This is useful in cases where the millis() timer is not
reliable, such as when sleeping. In this case, it is up to the caller to
ensure that at least 2 seconds elapse between calls with force set to
true.
2015-07-24 21:40:22 +02:00
5cd78aead6 Fix merge conflict with interrupt disable lock. 2015-07-22 12:22:35 -07:00
85d85170bd Fix #37 by optimizing pulse read to use direct port access on AVR, stops checksum failures from missed signals. 2015-07-22 12:13:56 -07:00
a2208eb813 Cause interrupts to be reenabled if a timeout occurs while waiting for the sensor. 2015-07-01 17:58:17 -07:00
ef9590ad96 Fix merge conflicts, make compute heat index default to Fahrenheit to not break old code that assumes default is Fahrenheit. 2015-06-26 15:56:04 -07:00
9d7a9da8ae Refactor algorithm to dynamically adjust to faster/slower processors. Fix #35 #30. 2015-06-26 15:14:17 -07:00
25942ac8b9 Added support for Celsius in computeHeatIndex 2014-11-01 12:27:16 +01:00
7f7425f11e Resolve #24 by adding convert F to C function. 2014-07-25 19:34:35 -07:00
f2a48d6267 Resolve issue #20 by moving delay after 2 second read check to make read return quickly. 2014-06-02 13:41:12 -07:00
9611395a77 Switch to use noInterrupts and interrupts function. make read() public. This resolves pull #15. 2014-06-02 13:13:50 -07:00
ce05c3536c Remove serial.print from library and update example error handling. Resolves issue #11 and #13. 2014-06-02 13:03:27 -07:00
ffac2f15b7 Update example to show temp in Fahrenheit and add computeHeatIndex function to resolve issue #9. 2014-06-02 12:54:54 -07:00