1 Commits

Author SHA1 Message Date
b1728b0509 feat: intégration DHT capteur 2023-04-04 11:22:24 +02:00
9 changed files with 32 additions and 2776 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
IOT/docs/doxygen output/*

View File

@ -15,6 +15,7 @@ build_flags =
; DO NOT TOUCH --- END
-D API_HOST=\"iot.epi.cb85.software\"
-D DHTTYPE=\"DHT11\"
-D DHTPIN=2
-D EXAMPLE_NUMBER=69

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
@startuml Class Diagram
Class API {
- user: String
- password: String
- serveurHost: String
- https: bool
- client: WiFiEspClient*
- connect(): bool
+ API(user: String, password: String, host: String, https: bool = true)
+ wifiBegin(wifiId: String, wifiPass: String, espSerial: Stream*): bool
+ sendValue(val: String, pouvelleID: String, unit: String, full: bool): bool
}
Class Program {
+ Program()
+ setup()
}
@enduml

View File

@ -1,6 +1,8 @@
#ifndef PROGRAM_H
#define PROGRAM_H
#include "DHT.h"
class Program{
public:
/**
@ -17,5 +19,11 @@ public:
private:
/* data */
/**
* @brief capteur humi/temp
*
*/
DHT *dht;
};
#endif

View File

@ -21,25 +21,25 @@ public:
/**
* @brief Initialise la connection Wifi de l'esp
*
* @param[in] wifiId nom du wifi
* @param[in] wifiPass mot de passe du wifi
* @param[in] espSerial port serie de l'esp (hard ou soft)
* @param wifiId nom du wifi
* @param wifiPass mot de passe du wifi
* @param espSerial port serie de l'esp (hard ou soft)
* @return true la connexion a bien fonctionner
* @return false erreur a la connexion
*/
bool wifiBegin(String wifiID, String wifiPass, Stream* espSerial);
bool wifiBegin(String wifiId, String wifiPass, Stream* espSerial);
/**
* @brief envoie la valeur d'un capteur de poubelle à l'api
*
* @param[in] val valeur du capteur
* @param[in] poubelleID ID de la poubelle
* @param[in] unit uniter de mesure du capteur *(ex: g, cm, degree,...)
* @param[in] full poubelle est considéré comme pleine
* @param val valeur du capteur
* @param poubelleID ID de la poubelle
* @param unit uniter de mesure du capteur *(ex: g, cm, degree,...)
* @param full poubelle est considéré comme pleine
* @return true la valeur s'est bien envoyer
* @return false il y a une erreur durran l'envoie
*/
bool sendValue(String val, String poubelleID, String unit, bool full);
bool sendValute(String val, String poubelleID, String unit, bool full);
private:

View File

@ -81,7 +81,7 @@ bool API::connect(){
return sortie;
}
bool API::sendValue(String val, String poubelleID, String valUnit, bool full){
bool API::sendValute(String val, String poubelleID, String valUnit, bool full){
JSONVar data;
data["value"] = val;
data["trash_id"] = poubelleID;

View File

@ -38,6 +38,8 @@ monitor_flags =
lib_deps =
bportaluri/WiFiEsp@^2.2.2 ; gestion des commande 'AT' de l'esp01
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:
; erropix/ESP32 AnalogWrite@^0.2

View File

@ -2,9 +2,19 @@
Program::Program(){
// INIT OBJ
this->dht = new DHT(DHTPIN, DHTTYPE);
Serial.begin(MONITOR_SPEED);
dht->begin();
}
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);
}