|
發表於 2019-2-24 22:34:56
|
顯示全部樓層
本文章最後由 xiaolaba 於 2019-2-24 10:56 PM 編輯
你有電路圖嗎
試試看單獨控制一個馬達, 改你自己需要一組STEPPER 驅動
如果可以動就是你的軟件驅動加速減速的問題, 不確定這個驅動IC是否內含加速減速控制功能, 假設沒有.
如果不動就是電流不足或者驅動IC壞的
MS1/MS2/MS3跳線帽要安裝好, 決定用微步還是滿步.
- /* Simple Stepper Motor Control Exaple Code
- *
- * by Dejan Nedelkovski, www.HowToMechatronics.com
- *
- */
- #define my_pin1 13 //Nano and test, xiaolaba
- #define my_pin2 12 //Nano and test, xiaolaba
- // defines pins numbers
- //const int stepPin = 3;
- //const int dirPin = 4;
- const int stepPin = my_pin1;
- const int dirPin = my_pin2;
-
- void setup() {
- // Sets the two pins as Outputs
- pinMode(stepPin,OUTPUT);
- pinMode(dirPin,OUTPUT);
- }
- void loop() {
- digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
- // Makes 200 pulses for making one full cycle rotation
- for(int x = 0; x < 200; x++) {
- digitalWrite(stepPin,HIGH);
- delayMicroseconds(500);
- digitalWrite(stepPin,LOW);
- delayMicroseconds(500);
- }
- delay(1000); // One second delay
-
- digitalWrite(dirPin,LOW); //Changes the rotations direction
- // Makes 400 pulses for making two full cycle rotation
- for(int x = 0; x < 200; x++) {
- digitalWrite(stepPin,HIGH);
- delayMicroseconds(500);
- digitalWrite(stepPin,LOW);
- delayMicroseconds(500);
- }
- delay(1000);
- }
複製代碼 |
評分
-
1
查看全部評分
-
|