Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed DRV88255 TextLCD Ping mbed-rtos
Diff: ProximityController.cpp
- Revision:
- 72:f8c4f731f0fe
- Parent:
- 68:b769c0f23406
--- a/ProximityController.cpp Tue Jun 21 12:09:12 2016 +0000
+++ b/ProximityController.cpp Tue Jun 21 13:48:28 2016 +0000
@@ -12,6 +12,8 @@
range = pinger.Read_cm()/ 2;
this->distance = (float)range;
+ printf("Read distance: %.3f\r\n", distance);
+
if(distance < 0.01) {
SensorAlarmController::buzzOnce();
setLed(true);
@@ -28,7 +30,7 @@
if(distance < 0.01) {
this->volume = -1.0f;
} else {
- this->volume = (DISTANCE_TO_BASE - this->distance) * ((100.0f/12.0f) * 10);
+ this->volume = (DISTANCE_TO_BASE - this->distance) * 76.92f;
}
return this->volume;