Leong Kum Loong (NYP) / HCSR04

Dependents:   Utrasonic_Example

Committer:
reesey
Date:
Mon Dec 04 04:35:49 2017 +0000
Revision:
2:c9ffa237213b
Parent:
0:3373f4da46c1
Written by Leong Kum Loong.; 04 Dec 2017, REV. 0;     ; When HCSR04.h reference is included, DO NOT declare pin p21 & p22 as it is used by my library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
reesey 0:3373f4da46c1 1 /*
reesey 0:3373f4da46c1 2 HCSR04.h
reesey 0:3373f4da46c1 3 Written by Leong Kum Loong.
reesey 0:3373f4da46c1 4 04 Dec 2017, REV. 0
reesey 0:3373f4da46c1 5
reesey 0:3373f4da46c1 6 All routines and functions in this library are written by me solely.
reesey 0:3373f4da46c1 7 Library for HC-SR04 Ultrasonic Ranging sensor.
reesey 0:3373f4da46c1 8 Library uses pins p21 to send pulse to sensor Trigger input & p22 to read sensor Echo output.
reesey 0:3373f4da46c1 9 This is assuming velocity of sound rate from ultrasonic pulse is 340m/s.
reesey 0:3373f4da46c1 10 */
reesey 0:3373f4da46c1 11
reesey 0:3373f4da46c1 12 #ifndef HCSR04_h
reesey 0:3373f4da46c1 13 #define HCSR04_h
reesey 0:3373f4da46c1 14 #include "mbed.h"
reesey 0:3373f4da46c1 15
reesey 0:3373f4da46c1 16 //1 for CM & 2 for INCH
reesey 0:3373f4da46c1 17 void getDistance(int unit=1);
reesey 0:3373f4da46c1 18
reesey 0:3373f4da46c1 19 //Read current distance.
reesey 0:3373f4da46c1 20 float readDistance();
reesey 0:3373f4da46c1 21
reesey 0:3373f4da46c1 22 #endif