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: HCSR04.h
- Revision:
- 0:3373f4da46c1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HCSR04.h Sun Dec 03 18:55:59 2017 +0000 @@ -0,0 +1,22 @@ +/* + HCSR04.h + Written by Leong Kum Loong. + 04 Dec 2017, REV. 0 + + All routines and functions in this library are written by me solely. + Library for HC-SR04 Ultrasonic Ranging sensor. + Library uses pins p21 to send pulse to sensor Trigger input & p22 to read sensor Echo output. + This is assuming velocity of sound rate from ultrasonic pulse is 340m/s. +*/ + +#ifndef HCSR04_h +#define HCSR04_h +#include "mbed.h" + +//1 for CM & 2 for INCH +void getDistance(int unit=1); + +//Read current distance. +float readDistance(); + +#endif \ No newline at end of file