Files
2023-02-10 08:57:50 +01:00

29 lines
636 B
C++

#pragma once
#include <Arduino.h>
#include "motor.h"
class MotorControl : public Motor{
public:
MotorControl(ShiftRegister* shiftRegister, uint8_t pwmPin,
uint8_t dirPinA, uint8_t dirPinB, uint8_t endstopPinA,
uint8_t endstopPinB);
void loop();
bool start() override;
bool getEndStopLeft();
bool getEndStopRight();
private:
Direction endstopTouched = Direction::None;
bool readPin(uint8_t pin);
uint8_t endstopPinA;
uint8_t endstopPinB;
uint32_t lastMillis = 0;
uint8_t loopDelay = 20;
};