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:
- 46:7e4c1f2ab76c
- Parent:
- 44:7c932cc5991b
- Child:
- 47:a73b8640fb60
--- a/PIDController.cpp Wed Jun 15 10:37:50 2016 +0000 +++ b/PIDController.cpp Wed Jun 15 10:55:44 2016 +0000 @@ -1,5 +1,6 @@ #include "PIDController.h" #include "testing.h" +#include "LCDController.h" DigitalOut heater(p18); @@ -76,6 +77,20 @@ int j = 5010 * (ml - 1); for (int i = 500; i < MAX_SPEED; i += 5) { + mtr->settings(1 / MICROSTEPS_PER_STEP, RIGHT, i); + } + + for (int i = 0; i < 2010 + j; i += 1) { + mtr->settings(1 / MICROSTEPS_PER_STEP, RIGHT, 8000); + } + + for (int i = 8000; i > 500; i -= 5) { + mtr->settings(1 / MICROSTEPS_PER_STEP, RIGHT, i); + } + + wait(5); + + for (int i = 500; i < MAX_SPEED; i += 5) { mtr->settings(1 / MICROSTEPS_PER_STEP, LEFT, i); } @@ -87,21 +102,7 @@ mtr->settings(1 / MICROSTEPS_PER_STEP, LEFT, i); } - wait(3); - - for (int i = 500; i < MAX_SPEED; i += 5) { - mtr->settings(1 / MICROSTEPS_PER_STEP, RIGHT, i); - } - - for (int i = 0; i < 2010 + j; i += 1) { - mtr->settings(1 / MICROSTEPS_PER_STEP, RIGHT, 8000); - } - - for (int i = 8000; i > 500; i -= 5) { - mtr->settings(1 / MICROSTEPS_PER_STEP, RIGHT, i); - } - - wait(3); + wait(5); this->pumping = false; } @@ -153,3 +154,8 @@ return (volume * (ppt / 7.0)) - volume; } +void PIDController::doTestingStuff(int ml) { + while(1) + this->pump_salt_water(ml); +} +