![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Proof of concept for distance and temperature monitoring
Dependencies: mbed mbedConnectorInterface mbedEndpointNetwork
Diff: hcsr04.h
- Revision:
- 10:338191178cbf
- Parent:
- 8:c69fe28366d8
diff -r 16b63cd4aba8 -r 338191178cbf hcsr04.h --- a/hcsr04.h Thu May 07 04:14:57 2015 +0000 +++ b/hcsr04.h Mon May 18 00:44:59 2015 +0000 @@ -35,6 +35,7 @@ { public: static const double kMicrosecondsToCentimeters = 343.0 / 20000; + static const double kBogusPulse = 500 / kMicrosecondsToCentimeters; /** Create a HCSR04 object connected to the specified pin * @param pin i/o pin to connect to @@ -46,10 +47,11 @@ * @param distance in cms and returns -1, in case of failure */ double get_dist_cm(void); + double get_max_dist_cm(void); /** Return the pulse duration equal to sonic waves travelling to obstacle and back to receiver. * @param pulse duration in microseconds. */ - unsigned int get_pulse_us(void); + int get_pulse_us(void); /** Generates the trigger pulse of 10us on the trigger PIN. */ void start(void ); @@ -65,7 +67,8 @@ Timer pulsetime; DigitalOut trigger; InterruptIn echo; - unsigned int pulsedur; + int pulsedur; + int maxpulse; }; #endif \ No newline at end of file