26 lines
499 B
C++
26 lines
499 B
C++
#pragma once
|
|
|
|
#include <time.h>
|
|
#include "Thing.h"
|
|
|
|
class Motor : public Thing {
|
|
public:
|
|
Motor();
|
|
/// @brief Turning direction of the motor
|
|
enum Direction { Forward = 1, Reverse = -1 };
|
|
|
|
/// @brief Set the turning direction of the motor
|
|
// void SetDirection(Direction direction);
|
|
|
|
virtual void SetSpeed(float speed);
|
|
float GetSpeed();
|
|
|
|
bool Drive(float distance);
|
|
|
|
protected:
|
|
float currentSpeed = 0;
|
|
bool driving = false;
|
|
float targetDistance = 0;
|
|
time_t startTime = 0;
|
|
};
|