39 lines
1.4 KiB
C++
39 lines
1.4 KiB
C++
#include "Program.h"
|
|
|
|
|
|
Program::Program(){
|
|
////////SERIALS//////
|
|
Serial1.begin(MONITOR_SPEED);
|
|
Serial.begin(MONITOR_SPEED);
|
|
|
|
////////API///////
|
|
this->api = new API(USER_NAME, USER_PASSWORD, API_HOST);
|
|
//this->api->wifiBegin(WIFI_SSID, WIFI_PASSWORD, &Serial1);
|
|
|
|
|
|
//////CAPTEUR/////
|
|
this->ultrasonic = new Ultrason(ULTRA_SOUND_TRIGD, ULTRA_SOUND_ECHO, "10");//TODO: mettre la valeur en config
|
|
this->dht = new HumiTemp(DHTPIN, DHTTYPE, "20:30/60:80");//TODO: mettre la valeur en config
|
|
this->balance = new Balance(POID_DOUT,POID_SCK,"500");//TODO: mettre la valter en donfig
|
|
this->balance->tar(1077);
|
|
}
|
|
|
|
void Program::loop(){
|
|
String distance = this->ultrasonic->read();
|
|
String humitemp = this->dht->read();
|
|
String poid = this->balance->read();
|
|
|
|
//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");
|
|
|
|
//this->api->sendValue(humitemp, TRASHCAN_TWO, this->dht->getValType(), this->dht->isFull());
|
|
Serial.print("humiTemp = " + this->dht->read());
|
|
Serial.println(this->dht->isFull()?" true":" false");
|
|
|
|
//this->api->sendValue(poid, TRASHCAN_TWO, this->balance->getValType(), this->balance->isFull());
|
|
Serial.print("humiTemp = " + this->dht->read());
|
|
Serial.println(this->dht->isFull()?" true":" false");
|
|
|
|
delay(1000);
|
|
} |