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.
Diff: Sensor/DistanceSensor.cpp
- Revision:
- 2:45082fedef80
- Parent:
- 1:a9251be32d0a
- Child:
- 3:511df198e214
--- a/Sensor/DistanceSensor.cpp Wed Nov 11 23:35:00 2020 +0000 +++ b/Sensor/DistanceSensor.cpp Thu Nov 12 01:22:53 2020 +0000 @@ -9,10 +9,12 @@ float DistanceSensor::getDistance_cm() { - if (m_analog >= 3.0){ + float distance = 0.0; + + if (m_analogIn >= 3.0){ distance = 5.0; } - else if (m_analog < 3.0 && m_analog >= 2.5){ + else if (m_analogIn < 3.0 && m_analogIn >= 2.5){ distance = 10.0; } else if (/* Fill in the blank */){