SparkFun Easy Driver stepper motor gone crazy !

Hey,

I'm using https://www.sparkfun.com/products/10267 SparkFun EasyDriver with the following code:

void setup()
{
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(12, OUTPUT);
    
  Serial.begin(9600);
  Serial.println("start");
}

void loop()
{
  stepper(9 ,10, 1000, HIGH);
  stepper(7 ,8, 1000, HIGH);
  stepper(6 ,12, 1000, HIGH);
}

void stepper(int StepPin, int DirPin, int Steps, int Direction)
{
    Serial.print("In stepper ");
    Serial.println(StepPin);
    int i;
    digitalWrite(DirPin, Direction);
    for (i=0; i < Steps; i++)
    {
        digitalWrite(StepPin, HIGH);
        delayMicroseconds(1000);
        digitalWrite(StepPin, LOW);
        delayMicroseconds(1000);
    }
}

It used to work good but suddenly without making any changes
The motors just shaking, i mean it looks like it goes 1 step forward then 1 backward very fast...
I tried changing delay, pins, direction but nothing changes it...

The motor just going crazy...

Any ideas?

Has the power supply changed? Have you tried adjusting the current regulator potentiometer on the Easy Driver board?

magagna:
Has the power supply changed? Have you tried adjusting the current regulator potentiometer on the Easy Driver board?

Nothing changed in the power supply.. and i tried adjustingthe potentiometer...
Nothing seems to work..

The only thing that changed is a new Mega 2560 and also tried with a new Uno..
I also got a new 10 meter USB cable.

Do you have a common ground between the Arduino, stepper driver, and stepper motor power supply?

Check motor wiring. And check it again. That is also what happens when the phases aren't wired correctly.