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.
Diff: HCSR04/SONAR_MANAGER.hpp
- Revision:
 - 2:0de4854743f7
 - Child:
 - 3:a4677501ae87
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HCSR04/SONAR_MANAGER.hpp	Thu Jun 10 01:23:00 2021 +0000
@@ -0,0 +1,27 @@
+#ifndef ZETA_BOT_MODULE_SONAR_MANAGER_HPP_
+#define ZETA_BOT_MODULE_SONAR_MANAGER_HPP_
+#include "HCSR04.h"
+#include "mbed.h"
+#include <vector>
+class SONAR_MANAGER
+{
+    public:
+        SONAR_MANAGER(PinName, HCSR04*, size_t);
+        void GetDistance(volatile float dest[]);
+        void PrintReady();
+        void Begin(float);
+    private:
+        DigitalOut trigger;
+        HCSR04* sonar;
+        size_t num_sonar;
+        float control_freq;
+        vector<float> distance;
+        Ticker scheduler;
+        Timeout triggerTimeout;
+        int ready[10];
+
+        void Loop();
+        void turnOffTrigger();
+};
+#endif
+