File tree Expand file tree Collapse file tree 8 files changed +17
-14
lines changed Expand file tree Collapse file tree 8 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 1
1
//
2
2
// FILE: DHT12.cpp
3
3
// AUTHOR: Rob Tillaart
4
- // VERSION: 0.1.1
4
+ // VERSION: 0.1.2
5
5
// PURPOSE: I2C library for DHT12 for Arduino.
6
6
//
7
7
// HISTORY:
8
8
// 0.1.0: 2017-12-11 initial version
9
9
// 0.1.1: 2017-12-19 added ESP8266 - issue #86
10
10
// Verified by Viktor Balint
11
+ // 0.1.2: 2018-09-02 fix negative temperature DHT12 - issue #111
12
+ //
11
13
//
12
14
// Released to the public domain
13
15
//
@@ -42,8 +44,8 @@ int8_t DHT12::read()
42
44
43
45
// CONVERT AND STORE
44
46
humidity = bits[0 ] + bits[1 ] * 0.1 ;
45
- temperature = ( bits[2 ] & 0x7F ) + bits[3 ] * 0.1 ;
46
- if (bits[2 ] & 0x80 )
47
+ temperature = bits[2 ] + ( bits[3 ] & 0x7F ) * 0.1 ;
48
+ if (bits[3 ] & 0x80 )
47
49
{
48
50
temperature = -temperature;
49
51
}
Original file line number Diff line number Diff line change 4
4
// FILE: DHT12.h
5
5
// AUTHOR: Rob Tillaart
6
6
// PURPOSE: DHT_I2C library for Arduino .
7
- // VERSION: 0.1.1
7
+ // VERSION: 0.1.2
8
8
// HISTORY: See DHT12.cpp
9
9
// URL: https://github.com/RobTillaart/Arduino/tree/master/libraries/
10
10
//
14
14
#include " Wire.h"
15
15
#include " Arduino.h"
16
16
17
- #define DHT12_VERSION " 0.1.1 "
17
+ #define DHT12_VERSION " 0.1.2 "
18
18
19
19
#define DHT12_OK 0
20
20
#define DHT12_ERROR_CHECKSUM -10
Original file line number Diff line number Diff line change 15
15
"type" : " git" ,
16
16
"url" : " https://github.com/RobTillaart/Arduino.git"
17
17
},
18
- "version" :" 0.1.1 " ,
18
+ "version" :" 0.1.2 " ,
19
19
"frameworks" : " arduino" ,
20
20
"platforms" : " *" ,
21
21
"export" : {
Original file line number Diff line number Diff line change 1
1
name =DHT12
2
- version =0.1.1
2
+ version =0.1.2
3
3
author =Rob Tillaart <rob.tillaart@gmail.com>
4
4
maintainer =Rob Tillaart <rob.tillaart@gmail.com>
5
5
sentence =I2C Library for DHT12 Temperature and Humidity.
Original file line number Diff line number Diff line change 1
1
//
2
2
// FILE: dht.cpp
3
3
// AUTHOR: Rob Tillaart
4
- // VERSION: 0.1.28
4
+ // VERSION: 0.1.29
5
5
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
6
6
// URL: http://arduino.cc/playground/Main/DHTLib
7
7
//
8
8
// HISTORY:
9
+ // 0.1.29 2018-09-02 fix negative temperature DHT12 - issue #111
9
10
// 0.1.28 2018-04-03 refactor
10
11
// 0.1.27 2018-03-26 added _disableIRQ flag
11
12
// 0.1.26 2017-12-12 explicit support for AM23XX series and DHT12
@@ -85,8 +86,8 @@ int8_t dht::read12(uint8_t pin)
85
86
86
87
// CONVERT AND STORE
87
88
humidity = bits[0 ] + bits[1 ] * 0.1 ;
88
- temperature = ( bits[2 ] & 0x7F ) + bits[3 ] * 0.1 ;
89
- if (bits[2 ] & 0x80 ) // negative temperature
89
+ temperature = bits[2 ] + ( bits[3 ] & 0x7F ) * 0.1 ;
90
+ if (bits[3 ] & 0x80 ) // negative temperature
90
91
{
91
92
temperature = -temperature;
92
93
}
Original file line number Diff line number Diff line change 1
1
//
2
2
// FILE: dht.h
3
3
// AUTHOR: Rob Tillaart
4
- // VERSION: 0.1.28
4
+ // VERSION: 0.1.29
5
5
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
6
6
// URL: http://arduino.cc/playground/Main/DHTLib
7
7
//
19
19
#include < Arduino.h>
20
20
#endif
21
21
22
- #define DHT_LIB_VERSION " 0.1.28 "
22
+ #define DHT_LIB_VERSION " 0.1.29 "
23
23
24
24
#define DHTLIB_OK 0
25
25
#define DHTLIB_ERROR_CHECKSUM -1
Original file line number Diff line number Diff line change 15
15
"type" : " git" ,
16
16
"url" : " https://github.com/RobTillaart/Arduino.git"
17
17
},
18
- "version" :" 0.1.28 " ,
18
+ "version" :" 0.1.29 " ,
19
19
"frameworks" : " arduino" ,
20
20
"platforms" : " *" ,
21
21
"export" : {
Original file line number Diff line number Diff line change 1
1
name =DHTlib
2
- version =0.1.28
2
+ version =0.1.29
3
3
author =Rob Tillaart <rob.tillaart@gmail.com>
4
4
maintainer =Rob Tillaart <rob.tillaart@gmail.com>
5
5
sentence =Optimized Library for DHT Temperature & Humidity Sensor on AVR only.
You can’t perform that action at this time.
0 commit comments