add dht11 flag

This commit is contained in:
Philipp Kramer 2023-11-15 12:23:38 +01:00
parent 2379a43b21
commit b3de99ea73
2 changed files with 37 additions and 2 deletions

View File

@ -19,9 +19,10 @@
#data_dir=data_sensoresp4 #data_dir=data_sensoresp4
#data_dir=data_sensoresp5 #data_dir=data_sensoresp5
#data_dir=data_sensoresp6 #data_dir=data_sensoresp6
data_dir=data_sensoresp7 #data_dir=data_sensoresp7
#data_dir=data_sensoresp3dprinter #data_dir=data_sensoresp3dprinter
#data_dir=data_sensoresptest #data_dir=data_sensoresptest
data_dir=data_sensoratd03
#Outdoor #Outdoor
@ -360,3 +361,32 @@ lib_deps =
Homie@3.0.0 Homie@3.0.0
SPI SPI
#Arbeitszimmer
[env:sensorespatd03]
platform = espressif8266 @ 2.5.0
board = d1_mini
framework = arduino
monitor_speed = 115200
build_flags =
-D SENSOR_DHT22
-D SENSOR_DHT22_PIN=D7
-D DHTTYPE=DHT11
-D SENSOR_DHT22_temperature_minchange=0.2
-D SENSOR_DHT22_humidity_minchange=2.0
-D SENSOR_BMP180
-D dataBMP180_temperature_minchange=0.2
-D dataBMP180_pressure_minchange=0.5
lib_deps =
Adafruit BMP085 Library@1.1.0
DHT sensor library@1.3.10
ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error
Homie@3.0.0

View File

@ -2,9 +2,14 @@
// Digital pin connected to the DHT sensor. // dht pins: 1=power, 2=data, 3=NC, 4=GND. 10k from data to power needed // Digital pin connected to the DHT sensor. // dht pins: 1=power, 2=data, 3=NC, 4=GND. 10k from data to power needed
#include "sensor_dht22.h" #include "sensor_dht22.h"
// if using dht11 instead of dth22 use: -D DHTTYPE=DHT11
#ifndef DHTTYPE
#define DHTTYPE DHT22
#endif
Sensor_DHT22::Sensor_DHT22(int pin) Sensor_DHT22::Sensor_DHT22(int pin)
{ {
dht = new DHT(pin,DHT22,11); //default:11 dht = new DHT(pin,DHTTYPE,11); //default:11
} }
void Sensor_DHT22::init() //Things to be done during setup() void Sensor_DHT22::init() //Things to be done during setup()