feat: intégration DHT capteur
This commit is contained in:
parent
a6abcd4fe1
commit
b1728b0509
@ -15,6 +15,7 @@ build_flags =
|
|||||||
; DO NOT TOUCH --- END
|
; DO NOT TOUCH --- END
|
||||||
|
|
||||||
-D API_HOST=\"iot.epi.cb85.software\"
|
-D API_HOST=\"iot.epi.cb85.software\"
|
||||||
|
-D DHTTYPE=\"DHT11\"
|
||||||
|
-D DHTPIN=2
|
||||||
|
|
||||||
-D EXAMPLE_NUMBER=69
|
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef PROGRAM_H
|
#ifndef PROGRAM_H
|
||||||
#define PROGRAM_H
|
#define PROGRAM_H
|
||||||
|
|
||||||
|
#include "DHT.h"
|
||||||
|
|
||||||
class Program{
|
class Program{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -17,5 +19,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/* data */
|
/* data */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief capteur humi/temp
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
DHT *dht;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
@ -38,6 +38,8 @@ monitor_flags =
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
bportaluri/WiFiEsp@^2.2.2 ; gestion des commande 'AT' de l'esp01
|
bportaluri/WiFiEsp@^2.2.2 ; gestion des commande 'AT' de l'esp01
|
||||||
arduino-libraries/Arduino_JSON@^0.2.0 ; gestion des json
|
arduino-libraries/Arduino_JSON@^0.2.0 ; gestion des json
|
||||||
|
adafruit/DHT sensor library@^1.4.4 ; DHT11 lib
|
||||||
|
adafruit/Adafruit Unified Sensor@^1.1.9 ; adafruit sensor lib (required by DHT11)
|
||||||
; example:
|
; example:
|
||||||
; erropix/ESP32 AnalogWrite@^0.2
|
; erropix/ESP32 AnalogWrite@^0.2
|
||||||
|
|
||||||
|
@ -2,9 +2,19 @@
|
|||||||
|
|
||||||
|
|
||||||
Program::Program(){
|
Program::Program(){
|
||||||
|
// INIT OBJ
|
||||||
|
this->dht = new DHT(DHTPIN, DHTTYPE);
|
||||||
|
|
||||||
|
Serial.begin(MONITOR_SPEED);
|
||||||
|
dht->begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Program::loop(){
|
void Program::loop(){
|
||||||
|
|
||||||
|
//TODO: envoyer les infos des capteur par la suite
|
||||||
|
|
||||||
|
Serial.println("Temperature = " + String(dht->readTemperature())+" °C");
|
||||||
|
Serial.println("Humidite = " + String(dht->readHumidity())+" %");
|
||||||
|
|
||||||
|
delay(1000);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user