void step(AccelStepper motor, float steps, float speed_value, float acceleration){ motor.moveTo(motor.currentPosition()+steps); motor.setSpeed(speed_value); //motor.setAcceleration(acceleration); // Implementation without acceleration. while (motor.distanceToGo() != 0) motor.runSpeedToPosition(); //motor.run(); }
void step(int motor, float steps, float feedrate){ AccelStepper stepper; if (motor == TURNTABLE_STEPPER ){ stepper = turntable; } if (motor == LASER_STEPPER){ stepper = laser; } stepper.move(steps*SCALER); stepper.setSpeed(100); //motor.setAcceleration(acceleration); // Implementation without acceleration. while (stepper.distanceToGo() != 0) stepper.runSpeedToPosition(); //motor.run(); }
void turn(){ if(isTurning){ turntable.setSpeed(1000); turntable.move(10); turntable.runSpeed(); } }
void moveTo(int desiredPosition) { leftStepper.setCurrentPosition(0); rightStepper.setCurrentPosition(0); leftStepper.moveTo(desiredPosition); rightStepper.moveTo(desiredPosition); }
void initSteppers() { leftStepper.setSpeed(motorSpeed); rightStepper.setSpeed(motorSpeed); leftStepper.setAcceleration(motorAccel); rightStepper.setAcceleration(motorAccel); // Timer3.getAvailable().attachInterrupt(processSteppers).setPeriod(10).start(); }
void processSteppers() { /* leftStepper.runSpeed(); rightStepper.runSpeed(); */ leftStepper.run(); rightStepper.run(); }
void home_y_axis(){ motors_enable(); while(!endStopSwitchReached(Y_ENDSTOP)){ step(y, 100, 10000, 10000); } y.setCurrentPosition(0.0); y.setSpeed(10000.0); motors_release(); }
void home_z_axis(){ motors_enable(); while(!endStopSwitchReached(Z_ENDSTOP)){ step(z, 10, 80000, 10000); } z.setCurrentPosition(0.0); z.setSpeed(30000.0); motors_release(); }
void initialize_motor_driver(){ pinMode(MICROSTEP, OUTPUT); digitalWrite(MICROSTEP,LOW); pinMode(ENABLE_PIN_0, OUTPUT); pinMode(ENABLE_PIN_1, OUTPUT); pinMode(STEP_PIN_0, OUTPUT); pinMode(STEP_PIN_1, OUTPUT); digitalWrite(MICROSTEP,HIGH); //motors_release(); laser.setMaxSpeed(2000.0); laser.setSpeed(700.0); turntable.setMaxSpeed(2000.0); turntable.setSpeed(700.0); turntable_motor_release(); laser_motor_release(); }
void init_motor_driver(){ pinMode(MICROSTEP,OUTPUT); pinMode(Z_ENABLE_PIN, OUTPUT); pinMode(Y_ENABLE_PIN, OUTPUT); motors_release(); z.setMaxSpeed(200000.0); z.setSpeed(10000.0); y.setMaxSpeed( 100000.0); y.setSpeed(1000.0); // Endstops pinMode(Y_ENDSTOP, INPUT); digitalWrite(Y_ENDSTOP, HIGH); motors_enable(); }
void stop() { leftStepper.stop(); rightStepper.stop(); }
void setMaxSpeed(int desiredMaxSpeed) { leftStepper.setMaxSpeed(desiredMaxSpeed); rightStepper.setMaxSpeed(desiredMaxSpeed); }
void setAcceleration(int desiredAcceleration) { leftStepper.setAcceleration(desiredAcceleration); rightStepper.setAcceleration(desiredAcceleration); }
void stepper_reset_done() { Astepper1.setSpeed(0); Astepper1.runSpeed(); }