示例#1
28
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();
     
}
示例#2
20
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();
}
示例#3
0
void initSteppers()
{
    leftStepper.setSpeed(motorSpeed);
    rightStepper.setSpeed(motorSpeed);
    leftStepper.setAcceleration(motorAccel);
    rightStepper.setAcceleration(motorAccel);
//    Timer3.getAvailable().attachInterrupt(processSteppers).setPeriod(10).start();
}
void turn(){
   if(isTurning){
    turntable.setSpeed(1000);
    turntable.move(10);
    turntable.runSpeed();
   } 
}
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();
}
示例#6
0
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();

}
示例#7
0
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();

}
示例#8
0
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();
    
}
示例#9
0
void setSpeed(int desiredSpeed)
{
    leftStepper.setSpeed(desiredSpeed);
    rightStepper.setSpeed(desiredSpeed);
}
void stepper_reset_done() {
  Astepper1.setSpeed(0);
  Astepper1.runSpeed();
}