Program for the water play project for the course Software Testing Practical 2016 given at the VU University
Dependencies: mbed DRV88255 TextLCD Ping mbed-rtos
Diff: PIDController.cpp
- Revision:
- 30:cf12566013a5
- Parent:
- 29:2b256a7ce0ae
- Child:
- 32:1e4919a44196
--- a/PIDController.cpp Tue Jun 14 09:57:44 2016 +0000 +++ b/PIDController.cpp Tue Jun 14 10:26:03 2016 +0000 @@ -1,14 +1,27 @@ #include "PIDController.h" - +#include "SalinityController.h" // This is called in the main loop on every iteration void PIDController::update() { // You can use the variables temp, salt and proximity like this: float s = this->salt->getValue(); + + if(s < 6.0) { + float sInGrams = this->getSaltInGrams(); + + float ml = SalinityController::getMl(sInGrams, this->proximity->getValue()); + + printf("PIDCONTROLLER: need to pump %.3f ml\r\n", ml); + + // MAYBE DO SOME ROUNDING HERE + + // DO SHIT WITH MOTORS AND STUFF + + } } std::string PIDController::get_name() { - return "PIDController"; + return "PIDController"; } //get the salt in the body in grams