diff --git a/IOT/include/Program.h b/IOT/include/Program.h index 53a6189..03e3115 100644 --- a/IOT/include/Program.h +++ b/IOT/include/Program.h @@ -1,6 +1,9 @@ #ifndef PROGRAM_H #define PROGRAM_H +#include +#include + class Program{ public: /** @@ -17,5 +20,11 @@ public: private: /* data */ + + /** + * @brief capteur ultra son pour le niveau de remplissage de la poubelle + * + */ + Ultrasonic *ultrasonic; }; #endif \ No newline at end of file diff --git a/IOT/src/Program.cpp b/IOT/src/Program.cpp index 952be1b..1f87003 100644 --- a/IOT/src/Program.cpp +++ b/IOT/src/Program.cpp @@ -1,10 +1,18 @@ #include "Program.h" +int distance; + + Program::Program(){ - + Serial.begin(MONITOR_SPEED); + this->ultrasonic = new Ultrasonic(ULTRA_SOUND_TRIGD, ULTRA_SOUND_ECHO); } void Program::loop(){ - + distance = this->ultrasonic->read(); + + Serial.print("Distance in CM: "); + Serial.println(distance); + delay(1000); } \ No newline at end of file