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