|
本帖最后由 liangquan 于 2014-11-19 18:43 编辑
如果用手触摸电机,可以感到电机在振动,但就是不转!!
- // Adafruit Motor shield library
- // copyright Adafruit Industries LLC, 2009
- // this code is public domain, enjoy!
- #include <AFMotor.h>
- // Connect a stepper motor with 48 steps per revolution (7.5 degree)
- // to motor port #2 (M3 and M4)
- AF_Stepper motor(48, 2);
- void setup() {
- Serial.begin(9600); // set up Serial library at 9600 bps
- Serial.println("Stepper test!");
- motor.setSpeed(10); // 10 rpm
- }
- void loop() {
- Serial.println("Single coil steps");
- motor.step(100, FORWARD, SINGLE);
- motor.step(100, BACKWARD, SINGLE);
- Serial.println("Double coil steps");
- motor.step(100, FORWARD, DOUBLE);
- motor.step(100, BACKWARD, DOUBLE);
- Serial.println("Interleave coil steps");
- motor.step(100, FORWARD, INTERLEAVE);
- motor.step(100, BACKWARD, INTERLEAVE);
- Serial.println("Micrsostep steps");
- motor.step(100, FORWARD, MICROSTEP);
- motor.step(100, BACKWARD, MICROSTEP);
- }
复制代码 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|