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.
Dependencies: Motordriver PixelArray RemoteIR
Diff: HCSR04/HCSR04.h
- Revision:
- 94:9050bb458b00
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/HCSR04/HCSR04.h Sun Jun 16 16:40:51 2019 +0000
@@ -0,0 +1,29 @@
+#ifndef hcsr04_H
+#define hcsr04_H
+#include "mbed.h"
+
+
+
+class HCSR04 {
+ public:
+ HCSR04(PinName t, PinName e, RawSerial pc,float interval=0.1, bool repeat = false, int done=0);
+ long echo_duration();
+ int distance();
+ float returninterval();
+ void Trig();
+ void setMode(bool mode);
+ int getStatus();
+ void clearStatus();
+
+ private:
+ bool _repeat;
+ float _interval;
+ int _done;
+ DigitalOut trig;
+ DigitalIn echo;
+ RawSerial _pc;
+ Timer timer;
+ long duration,distance_cm;
+};
+
+#endif
\ No newline at end of file