feat: gestion oled screen #48

Merged
Clement merged 5 commits from feat/oled-screen into master 2023-05-14 07:16:32 +00:00
2 changed files with 16 additions and 0 deletions
Showing only changes of commit b0c90360b8 - Show all commits

View File

@ -10,6 +10,7 @@
#include "Ultrason.h" #include "Ultrason.h"
#include "HumiTemp.h" #include "HumiTemp.h"
#include "Balance.h" #include "Balance.h"
#include "OledScreen.h"
class Program{ class Program{
public: public:
@ -46,6 +47,12 @@ private:
*/ */
Capteur *balance; Capteur *balance;
/**
* @brief OledScreen
*
*/
OledScreen* screen;
/** /**
* @brief Réference de l'API pour les calls * @brief Réference de l'API pour les calls
* *

View File

@ -6,6 +6,10 @@ Program::Program(){
Serial1.begin(MONITOR_SPEED); Serial1.begin(MONITOR_SPEED);
Serial.begin(MONITOR_SPEED); Serial.begin(MONITOR_SPEED);
//////Oled Screen/////
this->screen = new OledScreen(OLED_WIDTH, OLED_HEIGHT, OLED_RESET);
this->screen->wifiWaiting();
////////API/////// ////////API///////
this->api = new API(USER_NAME, USER_PASSWORD, API_HOST); this->api = new API(USER_NAME, USER_PASSWORD, API_HOST);
this->api->wifiBegin(WIFI_SSID, WIFI_PASSWORD, &Serial1); this->api->wifiBegin(WIFI_SSID, WIFI_PASSWORD, &Serial1);
@ -16,12 +20,17 @@ Program::Program(){
this->dht = new HumiTemp(DHTPIN, DHTTYPE, DHT_FULL); this->dht = new HumiTemp(DHTPIN, DHTTYPE, DHT_FULL);
this->balance = new Balance(POID_DOUT,POID_SCK, POID_FULL); this->balance = new Balance(POID_DOUT,POID_SCK, POID_FULL);
this->balance->tar(1077); this->balance->tar(1077);
this->screen->clear();
} }
void Program::loop(){ void Program::loop(){
String distance = this->ultrasonic->read(); String distance = this->ultrasonic->read();
String humitemp = this->dht->read(); String humitemp = this->dht->read();
String poid = this->balance->read(); String poid = this->balance->read();
this->screen->printVal(distance, poid, humitemp);
this->api->sendValue(distance, TRASHCAN_ONE, this->ultrasonic->getValType(), this->ultrasonic->isFull()); this->api->sendValue(distance, TRASHCAN_ONE, this->ultrasonic->getValType(), this->ultrasonic->isFull());
Serial.print("Distance in CM = " + distance); Serial.print("Distance in CM = " + distance);