- move code for all devices in dedicated folder - move code for gateway in the root folder
17 lines
303 B
C++
17 lines
303 B
C++
#pragma once
|
|
|
|
#include "GenericSensor.h"
|
|
#include <NewPing.h>
|
|
|
|
|
|
class SonarSensor : public GenericSensor {
|
|
private:
|
|
NewPing sonar{ TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE };
|
|
public:
|
|
SonarSensor(short id) : GenericSensor(id) {}
|
|
|
|
unsigned int scan() {
|
|
return sonar.convert_cm(sonar.ping_median());
|
|
}
|
|
};
|