Go to the documentation of this file.
59 uint8_t forwardWhenLowPin,
61 unsigned long pulsesPerMeter);
83 unsigned long pulsesPerMeter);
86 void reset()
override;
113 const uint8_t mDirectionPin;
115 const int kPinStateWhenForward;
116 volatile unsigned long mNegativePulsesCounter{ 0 };
117 volatile int mDirectionPinState;
DirectionalOdometer(Runtime &runtime, uint8_t pulsePin, uint8_t forwardWhenLowPin, InterruptCallback callback, unsigned long pulsesPerMeter)
Constructs an odometer that can measure distance, speed and direction.
A callback to be invoked. Depending on the platform different callback types may be necessary.
void reset() override
Resets the total travelled distance and speed to 0
void update() override
Conducts the distance and speed measurements.
int8_t getDirection() const
Get the direction of movement.
long getDistance() override
Returns the travelled distance in centimeters where sign can indicate direction if there is hardware ...
bool providesDirection() const override
Return whether the sensor is capable of inferring the direction of movement.
float getSpeed() override
Returns the current speed in meters/sec where sign can indicate direction if there is hardware suppor...
Helper class to represent directional odometer pins.
DirectionalOdometerPins(uint8_t pulsePin, uint8_t forwardWhenLowPin)
Construct a DirectionalOdometerPins object.