Implement speedometer and encoder
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#ifndef SPEEDOMETER_H
|
||||
#define SPEEDOMETER_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <ESP32Encoder.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
class Speedometer {
|
||||
public:
|
||||
Speedometer();
|
||||
void init(uint8_t pinA, uint8_t pinB);
|
||||
void runSpeedometer();
|
||||
double getSpeed();
|
||||
uint8_t getDirection();
|
||||
|
||||
|
||||
private:
|
||||
ESP32Encoder encoder;
|
||||
|
||||
double speed = 0;
|
||||
uint32_t last_millis = 0;
|
||||
};
|
||||
|
||||
#endif // SPEEDOMETER_H
|
||||
Reference in New Issue
Block a user