Arduino Mega 2560
AF-compatible motorshield
This small sample (http://pastebin.com/raw.php?i=3qEbf6Si) engages the motor properly but doesn't seem inclined to release it with the disableOutputs() command. I'm hoping/expecting the motor shield will just rotate freely when disableOutputs() is called. This isn't a complicated library. What am I missing?
thanks! polarhb
#include <AccelStepper.h>
#include <AFMotor.h>
const int stepType = INTERLEAVE;
const int motorStepsPerRev = 400;
AF_Stepper afMotorA(motorStepsPerRev, 1);
void forwarda() { afMotorA.onestep(FORWARD, stepType); }
void backwarda() { afMotorA.onestep(BACKWARD, stepType); }
AccelStepper motorA(forwarda, backwarda);
void setup() {
Serial.begin(57600);
Serial.println("Engaging motors.");
motorA.enableOutputs();
motorA.setMaxSpeed(300);
motorA.setAcceleration(100);
motorA.runToNewPosition(motorA.currentPosition()+32);
motorA.runToNewPosition(motorA.currentPosition()-32);
delay(500);
Serial.println("Disengaging motors. (should rotate freely?)");
motorA.disableOutputs();
}
void loop() {
}
|