Leong Kum Loong (NYP) / HCSR04

Dependents:   Utrasonic_Example

HCSR04.h

Committer:
reesey
Date:
2017-12-03
Revision:
0:3373f4da46c1

File content as of revision 0:3373f4da46c1:

/*
    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