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.
HCSR04.h
- Committer:
- reesey
- Date:
- 2017-12-04
- Revision:
- 2:c9ffa237213b
- Parent:
- 0:3373f4da46c1
File content as of revision 2:c9ffa237213b:
/*
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