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

Committer:
joran
Date:
Mon Jun 13 13:41:25 2016 +0000
Revision:
24:eeef4009640d
Parent:
10:fd4670ec0806
Child:
27:4f73f754fdc9
Proximity controller calculates ml now, for a small flask.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joran 5:44ce56378b65 1 #include "ProximityController.h"
sbouber1 10:fd4670ec0806 2 #include "rtos.h"
joran 5:44ce56378b65 3
joran 5:44ce56378b65 4 Ping pinger(p30);
joran 5:44ce56378b65 5
joran 24:eeef4009640d 6 float distance_to_base = 14.5;
joran 5:44ce56378b65 7
sbouber1 10:fd4670ec0806 8 void ProximityController::update() {
joran 5:44ce56378b65 9 int range;
joran 5:44ce56378b65 10
joran 5:44ce56378b65 11 pinger.Send();
sbouber1 10:fd4670ec0806 12 Thread::wait(30);
joran 5:44ce56378b65 13 range = pinger.Read_cm()/ 2;
sbouber1 10:fd4670ec0806 14 this->distance = (float)range;
sbouber1 10:fd4670ec0806 15 }
sbouber1 10:fd4670ec0806 16
joran 24:eeef4009640d 17 float ProximityController::getDistance()
joran 24:eeef4009640d 18 {
joran 24:eeef4009640d 19 return this->distance;
joran 24:eeef4009640d 20 }
sbouber1 10:fd4670ec0806 21
sbouber1 10:fd4670ec0806 22 float ProximityController::getValue() {
joran 24:eeef4009640d 23 this->volume = (this->ditance - distance_to_base) * ((100/12) *10);
joran 24:eeef4009640d 24 return this->volume;
sbouber1 10:fd4670ec0806 25 }
sbouber1 10:fd4670ec0806 26
sbouber1 10:fd4670ec0806 27 std::string ProximityController::get_name() {
sbouber1 10:fd4670ec0806 28 return "ProximityController";
sbouber1 10:fd4670ec0806 29 }