示例#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
0
void moveTo(int desiredPosition)
{
    leftStepper.setCurrentPosition(0);
    rightStepper.setCurrentPosition(0);
    leftStepper.moveTo(desiredPosition);
    rightStepper.moveTo(desiredPosition);
}