Initial commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "shiftregister.h"
|
||||
|
||||
class Motor {
|
||||
public:
|
||||
enum Direction : byte{
|
||||
None,
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
|
||||
Motor(ShiftRegister* shiftRegister, uint8_t pwmPin, uint8_t dirPinA, uint8_t dirPinB);
|
||||
Motor(uint8_t pwmPin, uint8_t dirPinA, uint8_t dirPinB);
|
||||
|
||||
void stop();
|
||||
virtual bool start();
|
||||
|
||||
void setDirection(Direction direction) { this->direction = direction; };
|
||||
void setSpeed(uint8_t speed) { this->speed = speed; }
|
||||
|
||||
protected:
|
||||
Direction direction = Direction::None;
|
||||
void configureMotor();
|
||||
|
||||
private:
|
||||
ShiftRegister* shiftRegister = nullptr;
|
||||
|
||||
|
||||
uint8_t pwmPin;
|
||||
uint8_t dirPinA;
|
||||
uint8_t dirPinB;
|
||||
uint8_t speed = 0;
|
||||
};
|
||||
Reference in New Issue
Block a user