Hi everyone,
I am trying to connect a stepper motor (model minebea C2164-60045), with this code the motor works:
int pin8 = 8;
int pin9 = 9;
int pin10 = 10;
int pin11 = 11;
void setup() {
pinMode(pin8, OUTPUT);
pinMode(pin9, OUTPUT);
pinMode(pin10, OUTPUT);
pinMode(pin11, OUTPUT);
}
void loop() {
digitalWrite(pin8, HIGH);
delay(5);
digitalWrite(pin8, LOW);
delay(2);
digitalWrite(pin9, HIGH);
delay(5);
digitalWrite(pin9, LOW);
delay(2);
digitalWrite(pin10, HIGH);
delay(5);
digitalWrite(pin10, LOW);
delay(2);
digitalWrite(pin11, HIGH);
delay(5);
digitalWrite(pin11, LOW);
delay(2);
}
but when i try to use the stepper library with this code it doesn't work, it only vibrates:
#include <Stepper.h>
const int stepsPerRevolution = 49; // change this to fit the number of steps per revolution
// for your motor
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);
void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}
The stepper library powers the motor this way:
Step C0 C1 C2 C3
1 1 0 1 0
2 0 1 1 0
3 0 1 0 1
4 1 0 0 1
But my motor works this way:
Step C0 C1 C2 C3
1 1 0 0 0
2 0 1 0 0
3 0 0 1 0
4 0 0 0 1
Any ideas on how I can use the stepper library with this motor.
Thanks in advance.