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.
HCSR04/SONAR_MANAGER.hpp@2:0de4854743f7, 2021-06-10 (annotated)
- Committer:
- _seminahn
- Date:
- Thu Jun 10 01:23:00 2021 +0000
- Revision:
- 2:0de4854743f7
- Child:
- 3:a4677501ae87
v1.1.0 change ssr logic
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| _seminahn | 2:0de4854743f7 | 1 | #ifndef ZETA_BOT_MODULE_SONAR_MANAGER_HPP_ |
| _seminahn | 2:0de4854743f7 | 2 | #define ZETA_BOT_MODULE_SONAR_MANAGER_HPP_ |
| _seminahn | 2:0de4854743f7 | 3 | #include "HCSR04.h" |
| _seminahn | 2:0de4854743f7 | 4 | #include "mbed.h" |
| _seminahn | 2:0de4854743f7 | 5 | #include <vector> |
| _seminahn | 2:0de4854743f7 | 6 | class SONAR_MANAGER |
| _seminahn | 2:0de4854743f7 | 7 | { |
| _seminahn | 2:0de4854743f7 | 8 | public: |
| _seminahn | 2:0de4854743f7 | 9 | SONAR_MANAGER(PinName, HCSR04*, size_t); |
| _seminahn | 2:0de4854743f7 | 10 | void GetDistance(volatile float dest[]); |
| _seminahn | 2:0de4854743f7 | 11 | void PrintReady(); |
| _seminahn | 2:0de4854743f7 | 12 | void Begin(float); |
| _seminahn | 2:0de4854743f7 | 13 | private: |
| _seminahn | 2:0de4854743f7 | 14 | DigitalOut trigger; |
| _seminahn | 2:0de4854743f7 | 15 | HCSR04* sonar; |
| _seminahn | 2:0de4854743f7 | 16 | size_t num_sonar; |
| _seminahn | 2:0de4854743f7 | 17 | float control_freq; |
| _seminahn | 2:0de4854743f7 | 18 | vector<float> distance; |
| _seminahn | 2:0de4854743f7 | 19 | Ticker scheduler; |
| _seminahn | 2:0de4854743f7 | 20 | Timeout triggerTimeout; |
| _seminahn | 2:0de4854743f7 | 21 | int ready[10]; |
| _seminahn | 2:0de4854743f7 | 22 | |
| _seminahn | 2:0de4854743f7 | 23 | void Loop(); |
| _seminahn | 2:0de4854743f7 | 24 | void turnOffTrigger(); |
| _seminahn | 2:0de4854743f7 | 25 | }; |
| _seminahn | 2:0de4854743f7 | 26 | #endif |
| _seminahn | 2:0de4854743f7 | 27 |