feat: use oled screen lib

This commit is contained in:
Clement 2023-05-14 09:06:08 +02:00
parent f2bd530d4e
commit b0c90360b8
2 changed files with 16 additions and 0 deletions

View File

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

View File

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