diff --git a/IOT/lib/Capteur/src/Balance.cpp b/IOT/lib/Capteur/src/Balance.cpp index 23eee99..2f0f69b 100644 --- a/IOT/lib/Capteur/src/Balance.cpp +++ b/IOT/lib/Capteur/src/Balance.cpp @@ -41,13 +41,14 @@ boolean Balance::calibration(int poidsRef,int moyenne_calibration) { } String Balance::read() { - + int sortie = (int)this->capteur->get_units(); + this->full = sortie > this->fullVall.toInt(); if (this->initialized == true) { - return String(this->capteur->get_units()); + return String(sortie); } else { return "0"; } -} +}//TODO: update isfull bool Balance::tar(int val){ this->initialized = true; diff --git a/IOT/src/Program.cpp b/IOT/src/Program.cpp index 1443c2f..6dd0b61 100644 --- a/IOT/src/Program.cpp +++ b/IOT/src/Program.cpp @@ -14,7 +14,7 @@ Program::Program(){ //////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 = new Balance(POID_DOUT,POID_SCK,"100");//TODO: mettre la valter en donfig this->balance->tar(1077); } @@ -28,12 +28,14 @@ void Program::loop(){ 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.print("humiTemp = " + humitemp); 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"); + Serial.print("poid = " + poid); + Serial.println(this->balance->isFull()?" true":" false"); + + Serial.println(); delay(1000); } \ No newline at end of file