I have been endlessly struggling trying to control a uni-polar 6 lead stepper motor with my mega 2560 and a sainsmart motor shield, but I just can't get it to work. I can step the motor manually by charging each of the four coils one at a time manually and I know which leads are which, but I cant seem to figure out how to integrate it with the arduino and sainsmart. I have a hunch it might be a problem with the code Im using or maybe I got the wrong digital I/O pins being used. Please Help!
int motorPin1 = 11;
int motorPin2 = 3;
int motorPin3 = 5;
int motorPin4 = 6;
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);
}