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.
Dependents: Esercitazione4_4 HC-SR04 Group10_slave Oled_Gus ... more
Diff: HCSR04.h
- Revision:
- 4:aae70f15357f
- Parent:
- 3:9a7899cf5e3a
- Child:
- 5:a667b621f625
diff -r 9a7899cf5e3a -r aae70f15357f HCSR04.h
--- a/HCSR04.h Sun Dec 06 15:13:54 2015 +0000
+++ b/HCSR04.h Mon Dec 07 09:37:21 2015 +0000
@@ -29,11 +29,32 @@
*/
HCSR04(PinName echoPin, PinName triggerPin);
- /** Calculates the distance in cm, with the calculation time of 25 ms.
+ /** Calculates the distance in cm, with the calculation time of approximatelly 23.7 ms.
* @returns distance of the measuring object in cm.
*/
float getDistance_cm();
+ /** Calculates the distance in mm, with the calculation time of approximatelly 23.7 ms.
+ * @returns distance of the measuring object in mm.
+ */
+ float getDistance_mm();
+
+ /** Sets the minimum and maximum ranges between the factory values of 2 cm and 400 cm.
+ * @param minRange Minimum range in cm. Must be between 2 cm and maxRange.
+ * @param maxRange Maximum range in cm. Must be between minRange and 400 cm.
+ */
+ void setRanges(float minRange, float maxRange);
+
+ /** Retreives the minimum sensor range set by the user.
+ * @returns the minimum sensor range set by the user in cm.
+ */
+ float getMinRange();
+
+ /** Retreives the maximum sensor range set by the user.
+ * @returns the maximum sensor range set by the user in cm.
+ */
+ float getMaxRange();
+
private:
InterruptIn echo; // echo pin