From 61321e0ca011517ac66eee3d92faf085869d5cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Fri, 16 Jun 2023 08:59:48 +0200 Subject: [PATCH 1/2] Update DHT library Change the library from DHT sensor + adds a wrapper class specifically for I2C connection (DHT20) --- examples/Temp_and_Humidity/Temp_and_Humidity.ino | 5 +++++ library.properties | 2 +- src/Arduino_SensorKit.cpp | 5 +++-- src/Arduino_SensorKit.h | 7 ++----- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/Temp_and_Humidity/Temp_and_Humidity.ino b/examples/Temp_and_Humidity/Temp_and_Humidity.ino index ae7a742..4dfce7d 100644 --- a/examples/Temp_and_Humidity/Temp_and_Humidity.ino +++ b/examples/Temp_and_Humidity/Temp_and_Humidity.ino @@ -1,7 +1,12 @@ //#define DHTPIN 3 // By default its connected to pin D3, it can be changed, define it before the #include of the library #include "Arduino_SensorKit.h" +//uncomment line below if using DHT20 +//#define Environment Environment_I2C + void setup() { + //uncomment line below if using DHT20 + //Wire.begin(); Serial.begin(9600); Environment.begin(); } diff --git a/library.properties b/library.properties index 2bb84fc..51162a9 100644 --- a/library.properties +++ b/library.properties @@ -8,4 +8,4 @@ category=Sensors url=https://sensorkit.arduino.cc/ architectures=avr precompiled=false -depends=DHT sensor library,Grove - Barometer Sensor BMP280,U8g2,Grove-3-Axis-Digital-Accelerometer-2g-to-16g-LIS3DHTR +depends=Grove Temperature And Humidity Sensor,Grove - Barometer Sensor BMP280,U8g2,Grove-3-Axis-Digital-Accelerometer-2g-to-16g-LIS3DHTR diff --git a/src/Arduino_SensorKit.cpp b/src/Arduino_SensorKit.cpp index 0c2a7c1..b7cdebb 100644 --- a/src/Arduino_SensorKit.cpp +++ b/src/Arduino_SensorKit.cpp @@ -2,6 +2,7 @@ //Declare component's classes U8X8_SSD1306_128X64_NONAME_SW_I2C Oled(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); -DHT Environment(DHTPIN, DHTTYPE); +DHT Environment(DHTPIN,DHT11); +DHT Environment_I2C(DHT20); SensorKit_LIS3DHTR Accelerometer; -SensorKit_BMP280 Pressure; +SensorKit_BMP280 Pressure; \ No newline at end of file diff --git a/src/Arduino_SensorKit.h b/src/Arduino_SensorKit.h index 9fdefb0..78348f1 100644 --- a/src/Arduino_SensorKit.h +++ b/src/Arduino_SensorKit.h @@ -16,10 +16,6 @@ #include "DHT.h" // Temp & Humidity #include "U8x8lib.h" // OLED Display -//Defines -#ifndef DHTTYPE - #define DHTTYPE DHT11 -#endif #ifndef DHTPIN #define DHTPIN 3 #endif @@ -29,4 +25,5 @@ extern U8X8_SSD1306_128X64_NONAME_SW_I2C Oled; extern SensorKit_LIS3DHTR Accelerometer; extern SensorKit_BMP280 Pressure; extern DHT Environment; -#endif +extern DHT Environment_I2C; +#endif \ No newline at end of file From 15469e39ced19769c441f4c944823a843dff5909 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Fri, 16 Jun 2023 09:55:39 +0200 Subject: [PATCH 2/2] Update compile examples workflow file --- .github/workflows/compile-examples.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index bf0c138..7e458c1 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -54,7 +54,7 @@ jobs: libraries: | # Install the library from the local path. - source-path: ./ - - name: DHT sensor library + - name: Grove Temperature And Humidity Sensor - name: Grove-3-Axis-Digital-Accelerometer-2g-to-16g-LIS3DHTR - name: Grove - Barometer Sensor BMP280 - name: U8g2