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:49:40 2016 +0000
Revision:
25:169672dbab91
Parent:
10:fd4670ec0806
Child:
27:4f73f754fdc9
proximity to ml

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() {
joran 25:169672dbab91 23 this->volume = (this->ditance - distance_to_base) * ((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 }