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
ec741c97f0
commit
e14b8c22c7
@ -6,6 +6,7 @@
|
||||
// URL: https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTstable
|
||||
//
|
||||
// HISTORY:
|
||||
// 0.2.1 2017-09-20 fix https://github.com/RobTillaart/Arduino/issues/80
|
||||
// 0.2.0 2017-07-24 fix https://github.com/RobTillaart/Arduino/issues/31 + 33
|
||||
// 0.1.13 fix negative temperature
|
||||
// 0.1.12 support DHT33 and DHT44 initial version
|
||||
@ -54,10 +55,11 @@ int 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];
|
||||
if (bits[4] != sum) return DHTLIB_ERROR_CHECKSUM;
|
||||
|
||||
uint8_t sum = bits[0] + bits[1] + bits[2] + bits[3];
|
||||
if (bits[4] != sum)
|
||||
{
|
||||
return DHTLIB_ERROR_CHECKSUM;
|
||||
}
|
||||
return DHTLIB_OK;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: dht.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.2.0
|
||||
// VERSION: 0.2.1
|
||||
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
|
||||
// URL: https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTstable
|
||||
//
|
||||
@ -18,7 +18,7 @@
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
#define DHT_LIB_VERSION "0.2.0 - dhtstable"
|
||||
#define DHT_LIB_VERSION "0.2.1 - dhtstable"
|
||||
|
||||
#define DHTLIB_OK 0
|
||||
#define DHTLIB_ERROR_CHECKSUM -1
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=DHTStable
|
||||
version=0.2.0
|
||||
version=0.2.1
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Stable version of library for DHT Temperature & Humidity Sensor
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
This is the 0.2.0 version of the DHTlib.
|
||||
This is the 0.2.1 version of the DHTlib.
|
||||
This version is stable for both ARM and AVR.
|
||||
|
||||
You can use most examples from https://github.com/RobTillaart/Arduino/tree/master/libraries/DHTlib/examples
|
||||
|
Loading…
Reference in New Issue
Block a user