RoboidControl-cpp/Arduino/Sensors/UltrasonicSensor.h
Pascal Serrarens f2f942d084 Refactoring
2025-02-28 15:01:23 +01:00

29 lines
544 B
C++

#pragma once
#include "Sensors/TouchSensor.h"
namespace RoboidControl {
namespace Arduino {
class UltrasonicSensor : public TouchSensor {
public:
UltrasonicSensor(Participant* participant, unsigned char pinTrigger, unsigned char pinEcho);
// parameters
float touchDistance = 0.2f;
// state
float distance = 0;
float GetDistance();
virtual void Update(unsigned long currentTimeMs) override;
protected:
unsigned char pinTrigger = 0;
unsigned char pinEcho = 0;
};
} // namespace Arduino
} // namespace RoboidControl