Nicu Hodos 89da9a80e8 re-organize:
- move code for all devices in dedicated folder
- move code for gateway in the root folder
2025-09-20 10:00:42 +02:00

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());
}
};