15 lines
371 B
C++
15 lines
371 B
C++
#include "DistanceSensor.h"
|
|
|
|
DistanceSensor::DistanceSensor() { this->type = Thing::DistanceSensorType; }
|
|
|
|
DistanceSensor::DistanceSensor(float triggerDistance) {
|
|
this->triggerDistance = triggerDistance;
|
|
}
|
|
|
|
float DistanceSensor::GetDistance() { return distance; };
|
|
|
|
bool DistanceSensor::ObjectNearby() {
|
|
bool isOn = GetDistance() <= triggerDistance;
|
|
return isOn;
|
|
}
|