Misc Pages needed information to be moved or recategorized: |
Toolkit /
MotorShieldSteppers//----------------
//Stepper 1 gets hooked up to motor ports 1 and 2 on the shield
//stepper 2 hooks up to 3 and 4
//INTERLEAVE and SINGLE seem to work with printer steppers
#include <AFMotor.h>
// Connect a stepper motor with 48 steps per revolution (7.5 degree)
// to motor port #2 (M3 and M4)
AF_Stepper motor1(48, 1);
AF_Stepper motor2(48, 2);
int i;
int s=255;
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Stepper test!");
motor1.setSpeed(200);
motor2.setSpeed(200);
}
void loop() {
for (i=0;i<s;i++){
Serial.println("Single coil steps");
motor1.step(1, FORWARD, INTERLEAVE);//INTERLEAVE seems to result in more torque, 1/2 speed.
motor2.step(1, FORWARD, INTERLEAVE); }
/*motor1.step(100, BACKWARD, SINGLE);
Serial.println("Double coil steps");
motor1.step(100, FORWARD, DOUBLE);
motor1.step(100, BACKWARD, DOUBLE);
Serial.println("Interleave coil steps");
motor1.step(100, FORWARD, INTERLEAVE);
motor1.step(100, BACKWARD, INTERLEAVE);
Serial.println("Micrsostep steps");
motor1.step(100, FORWARD, MICROSTEP); //very low torque
motor1.step(100, BACKWARD, MICROSTEP); */
}
|