45int _fullStepCount = 4;
46int _fullSteps[][4] = {
63bool _clockwise =
true;
65void setup_PTStepper();
66void cycle_PTStepper();
67void step(
int steps[][4],
int stepCount);
74 for (
int pin = 0; pin < 4; pin++) {
75 pinMode(_pins[pin], OUTPUT);
76 digitalWrite(_pins[pin], LOW);
99 SerialDebug.printf(
"STEPPER STEPS = %d\n", _targetSteps);
106 switch(_fudgeFactor) {
108 _targetSteps = _targetSteps + 2;
112 _targetSteps = _targetSteps + 2;
116 _targetSteps = _targetSteps + 3;
125 SerialDebug.printf(
"MOTOR_DIRECTION_CLOCKWISE = %d\n", _clockwise);
130void setup_PTStepper() {
137void step(
int steps[][4],
int stepCount) {
142 int currentStepInSequence = _currentStep % stepCount;
146 int directionStep = _clockwise ? currentStepInSequence : (stepCount - 1) - currentStepInSequence;
150 for (
int pin = 0; pin < 4; pin++) {
151 digitalWrite(_pins[pin], steps[directionStep][pin]);
155void cycle_PTStepper() {
160 int stepCount = _fullStepCount;
161 step(_fullSteps, _fullStepCount);
168 if (_targetSteps != 0 && _currentStep == _targetSteps) {
172 else if (_targetSteps == 0 && _currentStep == stepCount) {
186void start_PTStepper() {
190 SerialDebug.print(
"Feeder type currently is ");
193 SerialDebug.println(
"**************** Starting Stepper *******************");
195 while (_cycleCounter < _targetSteps) {
201 SerialDebug.println(
"**************** Ending Stepper *************");
206 SerialDebug.println(
"**************** Starting Return *******************");
207 _clockwise = !_clockwise;
208 while (_cycleCounter < _targetSteps - 5) {
215 _clockwise = !_clockwise;
216 SerialDebug.println(
"**************** Emding Return ***********");
int getFeederType_mainModule()
get the feeder type (Sepper 1,2,3 ...)
float getPreferenceFloat_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
boolean getPreferenceBoolean_mainModule(int preferenceID)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
#define PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING
#define PREFERENCE_STEPPER_CLOCKWISE_MOTOR_DIRECTION_SETTING