本文整理汇总了C++中AccelStepper类的典型用法代码示例。如果您正苦于以下问题:C++ AccelStepper类的具体用法?C++ AccelStepper怎么用?C++ AccelStepper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AccelStepper类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: step
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: step
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: turn
void turn(){
if(isTurning){
turntable.setSpeed(1000);
turntable.move(10);
turntable.runSpeed();
}
}
示例4: moveTo
void moveTo(int desiredPosition)
{
leftStepper.setCurrentPosition(0);
rightStepper.setCurrentPosition(0);
leftStepper.moveTo(desiredPosition);
rightStepper.moveTo(desiredPosition);
}
示例5: initSteppers
void initSteppers()
{
leftStepper.setSpeed(motorSpeed);
rightStepper.setSpeed(motorSpeed);
leftStepper.setAcceleration(motorAccel);
rightStepper.setAcceleration(motorAccel);
// Timer3.getAvailable().attachInterrupt(processSteppers).setPeriod(10).start();
}
示例6: processSteppers
void processSteppers()
{
/*
leftStepper.runSpeed();
rightStepper.runSpeed();
*/
leftStepper.run();
rightStepper.run();
}
示例7: home_y_axis
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();
}
示例8: home_z_axis
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: initialize_motor_driver
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();
}
示例10: init_motor_driver
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();
}
示例11: stop
void stop()
{
leftStepper.stop();
rightStepper.stop();
}
示例12: setMaxSpeed
void setMaxSpeed(int desiredMaxSpeed)
{
leftStepper.setMaxSpeed(desiredMaxSpeed);
rightStepper.setMaxSpeed(desiredMaxSpeed);
}
示例13: setAcceleration
void setAcceleration(int desiredAcceleration)
{
leftStepper.setAcceleration(desiredAcceleration);
rightStepper.setAcceleration(desiredAcceleration);
}
示例14: stepper_reset_done
void stepper_reset_done() {
Astepper1.setSpeed(0);
Astepper1.runSpeed();
}