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: FastAnalogIn mbed-rtos mbed
Fork of dipl_prace_v10 by
Diff: ultrasonic.h
- Revision:
- 0:f3b355df6f26
diff -r 000000000000 -r f3b355df6f26 ultrasonic.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ultrasonic.h Sun Apr 26 13:14:02 2015 +0000
@@ -0,0 +1,35 @@
+#ifndef _ULTRASONIC_H
+#define _ULTRASONIC_H
+
+#include "mbed.h"
+#include "rtos.h"
+
+class cUltrasonic {
+ public:
+ cUltrasonic(PinName pinEcho, PinName pinTrig);
+
+ /* This method set trigger */
+ void setTrig();
+
+ /* This method returns width of received pulse*/
+ int getPulseWidth();
+
+ /* Pointer to thread*/
+ Thread* thread;
+
+ private:
+ DigitalOut trig;
+ InterruptIn echo;
+
+ Timer timer;
+ float pulseWidth;
+
+ /* ISR of rising edge */
+ void riseEdge(void);
+
+ /* ISR of falling edge*/
+ void fallEdge(void);
+
+
+};
+#endif
\ No newline at end of file
