# Arduino 步进电机到指定距离后变速

> 原文链接：https://robotics.hellobike.com/pitfalls/2015-04-03-robotics-se-1947
> 频道：pitfalls | 更新日期：2015-04-03 | 标签：auto, stackexchange, arduino, control, stepper-motor
> 核心摘要：步进电机需在行进到指定距离后提速，采纳答案建议用轮子编码器测距后触发变速。

# Arduino 步进电机到指定距离后变速

::: v-pre
> 本文由 AI 根据公开内容整理，可能有误，请以原文为准：[I want my stepper motor to switch speed while traveling (not acceleration wise)](https://robotics.stackexchange.com/questions/1947/i-want-my-stepper-motor-to-switch-speed-while-traveling-not-acceleration-wise)（Robotics Stack Exchange #1947）

**状态**：已解决

## 问题

使用 Arduino 和 `AccelStepper` 控制步进电机，想先以速度 200 移动到 2500，再提速到 400，移动到 5000 后再返回；无报错。

## 环境

嵌入式控制器 / 串口通信

## 解决办法

1. 在轮子上使用编码器计算已行驶距离。
2. 当编码器测得达到目标距离时，提高步进电机速度。

原问题作者：hollander；采纳答案作者：OricTosh。原内容依 CC BY-SA 4.0 授权，本页摘要同样依 CC BY-SA 4.0 授权。
:::

## 原始参考来源 (Sources)

- [Robotics Stack Exchange #1947：I want my stepper motor to switch speed while traveling (not acceleration wise)](https://robotics.stackexchange.com/questions/1947/i-want-my-stepper-motor-to-switch-speed-while-traveling-not-acceleration-wise)