mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
Fix checksum for DHT11 upon request.
This commit is contained in:
parent
83ef3dc636
commit
ec741c97f0
@ -1,12 +1,13 @@
|
||||
//
|
||||
// FILE: dht.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.24
|
||||
// VERSION: 0.1.25
|
||||
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
|
||||
// URL: http://arduino.cc/playground/Main/DHTLib
|
||||
//
|
||||
// HISTORY:
|
||||
// 0.1.24 2017-07-27 double -> float
|
||||
// 0.1.25 2017-09-20 FIX https://github.com/RobTillaart/Arduino/issues/80
|
||||
// 0.1.24 2017-07-27 FIX https://github.com/RobTillaart/Arduino/issues/33 double -> float
|
||||
// 0.1.23 2017-07-24 FIX https://github.com/RobTillaart/Arduino/issues/31
|
||||
// 0.1.22 undo delayMicroseconds() for wakeups larger than 8
|
||||
// 0.1.21 replace delay with delayMicroseconds() + small fix
|
||||
@ -62,8 +63,7 @@ int8_t dht::read11(uint8_t pin)
|
||||
temperature = bits[2]; // bits[3] == 0;
|
||||
|
||||
// TEST CHECKSUM
|
||||
// bits[1] && bits[3] both 0
|
||||
uint8_t sum = bits[0] + bits[2];
|
||||
uint8_t sum = bits[0] + bits[1] + bits[2] + bits[3];
|
||||
if (bits[4] != sum)
|
||||
{
|
||||
return DHTLIB_ERROR_CHECKSUM;
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: dht.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.24
|
||||
// VERSION: 0.1.25
|
||||
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
|
||||
// URL: http://arduino.cc/playground/Main/DHTLib
|
||||
//
|
||||
@ -19,7 +19,7 @@
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
#define DHT_LIB_VERSION "0.1.24"
|
||||
#define DHT_LIB_VERSION "0.1.25"
|
||||
|
||||
#define DHTLIB_OK 0
|
||||
#define DHTLIB_ERROR_CHECKSUM -1
|
||||
|
@ -1,9 +1,9 @@
|
||||
name=DHTlib
|
||||
version=0.1.24
|
||||
version=0.1.25
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Optimized Library for DHT Temperature & Humidity Sensor on AVR only.
|
||||
paragraph=
|
||||
category=Sensors
|
||||
url=https://github.com/RobTillaart/Arduino/tree/master/libraries/
|
||||
url=https://github.com/RobTillaart/Arduino/tree/master/libraries
|
||||
architectures=atmelavr
|
@ -43,3 +43,4 @@ TODO pin description
|
||||
* version 0.1.22 undo delayMicroseconds() for wakeups larger than 8
|
||||
* version 0.1.23 FIX https://github.com/RobTillaart/Arduino/issues/31
|
||||
* version 0.1.24 FIX https://github.com/RobTillaart/Arduino/issues/33
|
||||
* version 0.1.25 FIX https://github.com/RobTillaart/Arduino/issues/80
|
||||
|
Loading…
x
Reference in New Issue
Block a user