Skip to content

Commit 61321e0

Browse files
committed
Update DHT library
Change the library from DHT sensor + adds a wrapper class specifically for I2C connection (DHT20)
1 parent a56d582 commit 61321e0

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

examples/Temp_and_Humidity/Temp_and_Humidity.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
//#define DHTPIN 3 // By default its connected to pin D3, it can be changed, define it before the #include of the library
22
#include "Arduino_SensorKit.h"
33

4+
//uncomment line below if using DHT20
5+
//#define Environment Environment_I2C
6+
47
void setup() {
8+
//uncomment line below if using DHT20
9+
//Wire.begin();
510
Serial.begin(9600);
611
Environment.begin();
712
}

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ category=Sensors
88
url=https://sensorkit.arduino.cc/
99
architectures=avr
1010
precompiled=false
11-
depends=DHT sensor library,Grove - Barometer Sensor BMP280,U8g2,Grove-3-Axis-Digital-Accelerometer-2g-to-16g-LIS3DHTR
11+
depends=Grove Temperature And Humidity Sensor,Grove - Barometer Sensor BMP280,U8g2,Grove-3-Axis-Digital-Accelerometer-2g-to-16g-LIS3DHTR

src/Arduino_SensorKit.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
//Declare component's classes
44
U8X8_SSD1306_128X64_NONAME_SW_I2C Oled(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);
5-
DHT Environment(DHTPIN, DHTTYPE);
5+
DHT Environment(DHTPIN,DHT11);
6+
DHT Environment_I2C(DHT20);
67
SensorKit_LIS3DHTR Accelerometer;
7-
SensorKit_BMP280 Pressure;
8+
SensorKit_BMP280 Pressure;

src/Arduino_SensorKit.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
#include "DHT.h" // Temp & Humidity
1717
#include "U8x8lib.h" // OLED Display
1818

19-
//Defines
20-
#ifndef DHTTYPE
21-
#define DHTTYPE DHT11
22-
#endif
2319
#ifndef DHTPIN
2420
#define DHTPIN 3
2521
#endif
@@ -29,4 +25,5 @@ extern U8X8_SSD1306_128X64_NONAME_SW_I2C Oled;
2925
extern SensorKit_LIS3DHTR Accelerometer;
3026
extern SensorKit_BMP280 Pressure;
3127
extern DHT Environment;
32-
#endif
28+
extern DHT Environment_I2C;
29+
#endif

0 commit comments

Comments
 (0)