Hello,
I recently bought a Unipolar Stepper Motor. It makes 7.5 degree of rotation per step (48 steps/rev).
I tried it on Arduino using ULN2003 with the Arduino's built-in Stepper.h library. It worked perfectly.
But the problem is, I don't want to use the built-in library. I want to make it work without the library. The reason for doing this is, I'll be using the same stepper motor on PIC and I think we don't have a library on PIC for this.
So I tested the following sequence:
1110
1101
1011
0111
And tested it with different delays after updating the new values. But the stepper motor did nothing but to vibrate about its original position. The bigger the delay, more jerky motion it produced.
Please help me make my own set of functions to control this stepper motor!
Here is the code I'm testing:
int motorPin1 = 7;
int motorPin2 = 8;
int motorPin3 = 9;
int motorPin4 = 10;
int delayTime = 100;
void setup() {
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
}
void loop() {
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
delay(delayTime);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
delay(delayTime);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
delay(delayTime);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
delay(delayTime);
}