如何解决步进电机转速和延迟
所以我使用 esp8266 和 tmc2130 步进驱动器来控制 nema 17 步进电机。我在设置正确的 rpm 时遇到了一些问题。我想将 rpm 设置为 4,5。这是我的代码:
#include <Stepper.h>
const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
#define motorSteps 200 //the same value as the steps per revolution above
// initialize the stepper library on pins D5 to D8
Stepper myStepper(stepsPerRevolution,D5,D6,D7,D8);
int stepCount = 0; // number of steps the motor has taken
void setup() {
myStepper.setSpeed (4,5);
}
void loop() {
// step one step:
myStepper.step(1);
stepCount++;
delay(1);
}
我认为延迟是一个问题,因为它每一步都等待一毫秒,所以 rpm 是不正确的。但我想我不能删除延迟,因为它必须在那里,因为驱动程序不能更快地执行这个任务,我猜有什么建议吗?提前致谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。