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:
sbouber1
Date:
Tue Jun 14 09:46:31 2016 +0000
Revision:
28:f4a4ee58d57e
Parent:
27:4f73f754fdc9
Child:
44:7c932cc5991b
pid controller class

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 25:169672dbab91 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 25:169672dbab91 17 float ProximityController::getDistance()
joran 25:169672dbab91 18 {
joran 25:169672dbab91 19 return this->distance;
joran 25:169672dbab91 20 }
sbouber1 10:fd4670ec0806 21
sbouber1 10:fd4670ec0806 22 float ProximityController::getValue() {
sbouber1 28:f4a4ee58d57e 23 this->volume = (distance_to_base - this->distance) * ((100/12) *10);
joran 25:169672dbab91 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 }