1701| 6
|
[进阶] arduino控制步进电机联动?怎么搞? |
电机一程序: forwardMotor.moveTo(-22 * moveSteps); while (forwardMotor.currentPosition() != (-22 * moveSteps)) { forwardMotor.run(); } 电机二程序: digitalWrite(rotateDir, LOW); while (1) { int receive = digitalRead(sensor1); digitalWrite(rotateStep, HIGH); delay(6); digitalWrite(rotateStep, LOW); delay(6); if (receive == 1) { break; } } 问题描述:电机一和电机二是先后运行。 目标:要求电机一和电机二同时开始运行,电机一按步数,电机二旋转直到传感器sensor1信号变成1才停止旋转。 |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed