13052| 14
|
[求助] 如何使用步进电机驱动扩展板? |
就是下面这货 按照教程连接电机 下面还接一块 UNO外接12V电源,把程序上传到UNO,重启却没有反应 [mw_shl_code=c,true]/* This sample code is for testing the 2 stepper motors The rotation velocity can be adjusted by the code switch Microcontroller: Arduino UNO */ int M1dirpin = 7; //电机X方向引脚 int M1steppin = 6; //电机X驱动引脚 int M1en=8; //电机X使能引脚 int M2dirpin = 4; //电机Y方向引脚 int M2steppin = 5; //电机Y驱动引脚 int M2en=12; //电机Y使能引脚 void setup() { pinMode(M1dirpin,OUTPUT); pinMode(M1steppin,OUTPUT); pinMode(M1en,OUTPUT); pinMode(M2dirpin,OUTPUT); pinMode(M2steppin,OUTPUT); pinMode(M2en,OUTPUT); digitalWrite(M1en,LOW); //低电平使能 digitalWrite(M2en,LOW); //低电平使能 } void loop() { int j; delayMicroseconds(2); digitalWrite(M1dirpin,LOW); digitalWrite(M2dirpin,LOW); for(j=0;j<=5000;j++){ digitalWrite(M1steppin,LOW); digitalWrite(M2steppin,LOW); delayMicroseconds(2); digitalWrite(M1steppin,HIGH); //上升沿步进 digitalWrite(M2steppin,HIGH); //上升沿步进 delay(1); } }[/mw_shl_code] 是不是必须要在扩展板外接电源才能启动? 还有我转动电机,扩展板上的指示灯会相应的亮起,那是不是说明接线没有问题? |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed