Commit Graph

38 Commits

Author SHA1 Message Date
Tony DiCola
232ad0cd70 Bump version to 1.2.0 after integrating optimizations from matthijskooijman. 2015-09-15 12:26:38 -07:00
Matthijs Kooijman
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
Matthijs Kooijman
45a20da301 Shrink DHT::data to 5 bytes
There's only 5 bytes of data being transferred (2x2 bytes of data, 1
byte checksum), so no need to keep a useless byte.
2015-07-24 21:43:52 +02:00
Matthijs Kooijman
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
Matthijs Kooijman
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
Matthijs Kooijman
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
Tony DiCola
5cd78aead6 Fix merge conflict with interrupt disable lock. 2015-07-22 12:22:35 -07:00
Tony DiCola
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
Tony DiCola
9419315c50 Merge pull request #36 from Zirientis/master
Cause interrupts to be reenabled if a timeout occurs while waiting for the sensor
2015-07-01 22:16:10 -07:00
Zirientis
a2208eb813 Cause interrupts to be reenabled if a timeout occurs while waiting for the sensor. 2015-07-01 17:58:17 -07:00
Tony DiCola
a1393fc0ff Merge branch 'MyIgel-master' 2015-06-26 15:56:28 -07:00
Tony DiCola
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
Tony DiCola
b6925ee001 Merge branch 'dynamic_timing' 2015-06-26 15:17:28 -07:00
Tony DiCola
729895339c Integrate keywords.txt from pull #31 2015-06-26 15:15:45 -07:00
Tony DiCola
9d7a9da8ae Refactor algorithm to dynamically adjust to faster/slower processors. Fix #35 #30. 2015-06-26 15:14:17 -07:00
Tony DiCola
a67e1a7e06 Automatic library.properties generation. 2015-03-31 12:09:43 -07:00
Igor Scheller
25942ac8b9 Added support for Celsius in computeHeatIndex 2014-11-01 12:27:16 +01:00
Tony DiCola
fcd865b3bc Update example to note cycle threshold parameter for Arduino Due. 2014-07-26 13:58:45 -07:00
Tony DiCola
7f7425f11e Resolve #24 by adding convert F to C function. 2014-07-25 19:34:35 -07:00
Tony DiCola
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
Tony DiCola
9611395a77 Switch to use noInterrupts and interrupts function. make read() public. This resolves pull #15. 2014-06-02 13:13:50 -07:00
Tony DiCola
ce05c3536c Remove serial.print from library and update example error handling. Resolves issue #11 and #13. 2014-06-02 13:03:27 -07:00
Tony DiCola
ffac2f15b7 Update example to show temp in Fahrenheit and add computeHeatIndex function to resolve issue #9. 2014-06-02 12:54:54 -07:00
Tony DiCola
633eb08654 Change example extension from .pde to .ino. 2014-06-02 12:36:44 -07:00
Limor "Ladyada" Fried
26e2bc1d79 Merge pull request #8 from soerup/master
Support for non 16 MHz devices by adding extra parameter to constructor
2013-01-02 07:58:47 -08:00
Lars Kirkeskov Sørup
ad73fab623 Support for non 16mhz devices
Added constructor parameter to allow for different timing needs. It has
the a default value of 6 which is the original value, so it should be
backwards compatible
2012-12-29 19:14:51 +01:00
Limor "Ladyada" Fried
71ee113a7b Merge pull request #4 from Jearil/master
Adding #ifndef DHT_H to header file
2012-08-26 18:42:37 -07:00
Colin Miller
fca71323bd Prevent dht.h being imported multiple times
Added a basic #ifndef DHT_H to the dht.h file so that if you have a
larger program and want to access the sensor from a different file, you
don't import it twice.
2012-07-26 21:39:47 -07:00
Paint Your Dragon
53e6481231 Default argument for compatibility with old sketches 2012-02-23 11:43:30 -08:00
Paint Your Dragon
14d816819c Merge pull request #3 from leprasmurf/master
Convert Celcius to Fahrenheit.
2012-02-23 11:27:41 -08:00
leprasmurf
a3d1dc78bf Added option for converting to Fahrenheit 2012-02-22 22:26:16 -05:00
leprasmurf
8f46f27b66 Modified readTemperature() prototype. Added prototype for new function. 2012-02-22 22:20:19 -05:00
Paint Your Dragon
cffd745009 Arduino 1.0 compliant 2011-12-02 19:50:02 -08:00
Ladyada
31b6b45352 clarified the pullup 2011-06-22 16:28:22 -04:00
Ladyada
b05219ab42 added mini readme 2011-06-22 16:12:33 -04:00
Ladyada
53f985c6b4 Example sketch 2011-06-22 16:09:13 -04:00
Ladyada
57ac62dab7 fully tested working DHT11/21/22 with built in '2 second' timer 2011-06-22 13:11:06 -04:00
Ladyada
7ecd3141a8 touch commit 2011-06-20 19:47:50 -04:00