2023-08-23 19:21:50 +00:00
|
|
|
#ifndef MCOPY_PROJECTOR
|
|
|
|
#define MCOPY_PROJECTOR
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include "IteadDualStepperShield.h"
|
|
|
|
|
|
|
|
class McopyProjector {
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
IteadDualStepperShield steppers;
|
|
|
|
|
|
|
|
uint8_t _motorSteps = 200;
|
|
|
|
uint8_t _frames = 8;
|
2023-08-25 20:44:28 +00:00
|
|
|
uint8_t _stepsPerFrame = 25; //round(_motorSteps / _frames);
|
|
|
|
uint16_t _speed = 300;
|
2023-08-23 19:21:50 +00:00
|
|
|
|
|
|
|
int64_t _posTakeup = 0;
|
|
|
|
int64_t _posFeed = 0;
|
|
|
|
|
2023-08-25 20:44:28 +00:00
|
|
|
const uint8_t FORWARD = 1; //CW
|
|
|
|
const uint8_t BACKWARD = 0; //CCW
|
|
|
|
|
|
|
|
const uint8_t TAKEUP = 0;
|
|
|
|
const uint8_t FEED = 0;
|
|
|
|
|
2023-08-23 19:21:50 +00:00
|
|
|
bool _dir = true;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
McopyProjector();
|
|
|
|
void begin();
|
|
|
|
//0 = takeup, 1 = feed
|
2023-08-25 20:44:28 +00:00
|
|
|
void adjust(uint8_t motor, int64_t steps);
|
|
|
|
void adjustBoth(int64_t steps);
|
2023-08-23 19:21:50 +00:00
|
|
|
//true = forward, false = back
|
|
|
|
void frame(bool dir);
|
2023-08-25 20:44:28 +00:00
|
|
|
void frames(bool dir, uint64_t count);
|
2023-08-23 19:21:50 +00:00
|
|
|
void setDirection(bool dir);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|