diff --git a/SphereBot Arduino/SphereBot/SphereBot.ino b/SphereBot Arduino/SphereBot/SphereBot.ino index 06bef0e..a7cfc1f 100644 --- a/SphereBot Arduino/SphereBot/SphereBot.ino +++ b/SphereBot Arduino/SphereBot/SphereBot.ino @@ -40,9 +40,9 @@ #define VERSIONCODE "Spherebot 2.0" -StepperModel xAxisStepper(XAXIS_DIR_PIN, XAXIS_STEP_PIN, XAXIS_ENABLE_PIN, XAXIS_ENDSTOP_PIN, XAXIS_MS1_PIN, XAXIS_MS2_PIN, XAXIS_VMS1, XAXIS_VMS2, +StepperModel xAxisStepper(XAXIS_DIR_PIN, XAXIS_STEP_PIN, XAXIS_ENABLE_PIN, XAXIS_ENDSTOP_PIN, XAXIS_MS1_PIN, XAXIS_MS2_PIN, XAXIS_MS3_PIN, XAXIS_VMS1, XAXIS_VMS2, XAXIS_VMS3, XAXIS_MIN_STEPCOUNT, XAXIS_MAX_STEPCOUNT, XAXIS_STEPS_PER_FULL_ROTATION, XAXIS_MICROSTEPPING); -StepperModel rotationStepper(YAXIS_DIR_PIN, YAXIS_STEP_PIN, YAXIS_ENABLE_PIN, YAXIS_ENDSTOP_PIN, YAXIS_MS1_PIN, YAXIS_MS2_PIN, YAXIS_VMS1, YAXIS_VMS2, +StepperModel rotationStepper(YAXIS_DIR_PIN, YAXIS_STEP_PIN, YAXIS_ENABLE_PIN, YAXIS_ENDSTOP_PIN, YAXIS_MS1_PIN, YAXIS_MS2_PIN, YAXIS_MS3_PIN, YAXIS_VMS1, YAXIS_VMS2, YAXIS_VMS3, YAXIS_MIN_STEPCOUNT, YAXIS_MIN_STEPCOUNT, YAXIS_STEPS_PER_FULL_ROTATION, YAXIS_MICROSTEPPING); SoftwareServo servo; diff --git a/SphereBot Arduino/SphereBot/StepperModel.cpp b/SphereBot Arduino/SphereBot/StepperModel.cpp index bb7fdda..f75ed70 100644 --- a/SphereBot Arduino/SphereBot/StepperModel.cpp +++ b/SphereBot Arduino/SphereBot/StepperModel.cpp @@ -22,7 +22,7 @@ /* * inEnablePin < 0 => No Endstop */ -StepperModel::StepperModel(int inDirPin, int inStepPin, int inEnablePin, int inEndStopPin,int inMs1Pin, int inMs2Pin, bool vms1,bool vms2, +StepperModel::StepperModel(int inDirPin, int inStepPin, int inEnablePin, int inEndStopPin, int inMs1Pin, int inMs2Pin, int inMs3Pin, bool vms1, bool vms2, bool vms3, long minSC, long maxSC, double in_kStepsPerRevolution, int in_kMicroStepping) { @@ -35,6 +35,7 @@ StepperModel::StepperModel(int inDirPin, int inStepPin, int inEnablePin, int inE endStopPin = inEndStopPin; ms1Pin = inMs1Pin; ms2Pin = inMs2Pin; + ms3Pin = inMs3Pin; minStepCount=minSC; maxStepCount=maxSC; @@ -44,12 +45,20 @@ StepperModel::StepperModel(int inDirPin, int inStepPin, int inEnablePin, int inE pinMode(enablePin, OUTPUT); if(endStopPin>=0) pinMode(endStopPin, INPUT); - if((ms1Pin >=0) && (ms2Pin >=0)) + if((ms1Pin >=0)) { - pinMode(ms1Pin, OUTPUT); - pinMode(ms2Pin, OUTPUT); + pinMode(ms1Pin, OUTPUT); digitalWrite(ms1Pin, vms1); - digitalWrite(ms2Pin, vms2); + } + if((ms2Pin >=0)) + { + pinMode(ms2Pin, OUTPUT); + digitalWrite(ms2Pin, vms1); + } + if((ms3Pin >=0)) + { + pinMode(ms3Pin, OUTPUT); + digitalWrite(ms3Pin, vms1); } digitalWrite(dirPin, LOW); diff --git a/SphereBot Arduino/SphereBot/StepperModel.h b/SphereBot Arduino/SphereBot/StepperModel.h index b317dec..99b163e 100644 --- a/SphereBot Arduino/SphereBot/StepperModel.h +++ b/SphereBot Arduino/SphereBot/StepperModel.h @@ -30,6 +30,8 @@ private: int enablePin; int ms1Pin; int ms2Pin; + int ms3Pin; + int endStopPin; long minStepCount; @@ -51,7 +53,7 @@ public: volatile long counter; double targetPosition; - StepperModel(int inDirPin, int inStepPin, int inEnablePin, int inEndStopPin,int inMs1Pin, int inMs2Pin,bool vms1,bool vms2, + StepperModel(int inDirPin, int inStepPin, int inEnablePin, int inEndStopPin,int inMs1Pin, int inMs2Pin, int inMs3Pin, bool vms1, bool vms2, bool vms3, long minSC, long maxSC, double in_kStepsPerRevolution, int in_kMicroStepping); diff --git a/SphereBot Arduino/SphereBot/config.h b/SphereBot Arduino/SphereBot/config.h index e36f882..97bfb77 100644 --- a/SphereBot Arduino/SphereBot/config.h +++ b/SphereBot Arduino/SphereBot/config.h @@ -10,6 +10,7 @@ #define YAXIS_ENABLE_PIN 21 #define YAXIS_MS1_PIN -1 #define YAXIS_MS2_PIN -1 +#define YAXIS_MS3_PIN -1 #define YAXIS_ENDSTOP_PIN -1 // -1 -> No Endstop #define YAXIS_VMS1 HIGH #define YAXIS_VMS2 HIGH @@ -25,6 +26,7 @@ #define XAXIS_ENABLE_PIN 2 #define XAXIS_MS1_PIN -1 #define XAXIS_MS2_PIN -1 +#define XAXIS_MS3_PIN -1 #define XAXIS_ENDSTOP_PIN -1 // -1 -> No Endstop #define XAXIS_VMS1 HIGH #define XAXIS_VMS2 HIGH