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
- Committer:
- _seminahn
- Date:
- 2021-06-10
- Revision:
- 2:0de4854743f7
- Child:
- 3:a4677501ae87
File content as of revision 2:0de4854743f7:
#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