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:
Sun Jun 19 22:39:16 2016 +0000
Revision:
58:b5f0c0f305ff
Parent:
44:7c932cc5991b
Child:
66:133398875949
update

Who changed what in which revision?

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