#include #include "BasicStepperDriver.h" #define X_STEP_PIN 54 #define X_DIR_PIN 55 #define X_ENABLE_PIN 38 #define Y_STEP_PIN 60 #define Y_DIR_PIN 61 #define Y_ENABLE_PIN 56 #define Z_STEP_PIN 46 #define Z_DIR_PIN 48 #define Z_ENABLE_PIN 62 #define E_STEP_PIN 26 #define E_DIR_PIN 28 #define E_ENABLE_PIN 24 #define Q_STEP_PIN 36 #define Q_DIR_PIN 34 #define Q_ENABLE_PIN 30 int FC[6] = { 3, 2, 14, 15, 18, 19}; int POT[5] = { A3, A4, A5, A10, A12}; unsigned long POT_VALUE[5] = { 0, 0, 0, 0, 0}; // Motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step #define MOTOR_STEPS 200 #define RPM 120 // Since microstepping is set externally, make sure this matches the selected mode // If it doesn't, the motor will move at a different RPM than chosen // 1=full step, 2=half step etc. #define MICROSTEPS 32 //Uncomment line to use enable/disable functionality BasicStepperDriver stepperX(MOTOR_STEPS, X_DIR_PIN, X_STEP_PIN, X_ENABLE_PIN ); BasicStepperDriver stepperY(MOTOR_STEPS, Y_DIR_PIN, Y_STEP_PIN, Y_ENABLE_PIN ); BasicStepperDriver stepperZ(MOTOR_STEPS, Z_DIR_PIN, Z_STEP_PIN, Z_ENABLE_PIN ); BasicStepperDriver stepperE(MOTOR_STEPS, E_DIR_PIN, E_STEP_PIN, E_ENABLE_PIN ); BasicStepperDriver stepperQ(MOTOR_STEPS, Q_DIR_PIN, Q_STEP_PIN, Q_ENABLE_PIN ); #define N 100 uint32_t average(int PIN) { uint32_t value = 0; for(int i=0; i359) stp[i] = 0; stp_move[i] = stp[i] - stp_actual[i]; if (stp_move[i]<0) { dir[i] = -1; stp_move[i] = abs(stp_move[i]); } else dir[i] = 1; //Serial.print("a="); //Serial.print(stp_actual[i]); stp_actual[i] = stp[i]; //Serial.print(", f="); //Serial.print(stp_actual[i]); //Serial.print(", m="); //Serial.print(stp_move[i]*dir[i]); //Serial.print(" "); } Serial.println(); if (stp_move[0]!=0) stepperX.enable(); if (stp_move[1]!=0) stepperY.enable(); if (stp_move[2]!=0) stepperZ.enable(); if (stp_move[3]!=0) stepperE.enable(); if (stp_move[4]!=0) stepperQ.enable(); int count = 0; while ((count