Pololu A4988 with Arduino Uno R3 works, but not with Leonardo!

Hi,

i have a Problem with the following sketch:

void Pololu_A4988_Example(){

digitalWrite(11, HIGH); // Motor On
delay(500); // delay for Controller startup
digitalWrite(9, LOW); // Turn right

for(double i = 0; i < 100000; i++) { //100000 steps in one direction
digitalWrite(10, HIGH);
delay(1);
digitalWrite(10, LOW);
delay(1);
}
digitalWrite(11, LOW); // Motor Off

delay(5000);

digitalWrite(11, HIGH); // Motor On
delay(500); // delay for Controller startup
digitalWrite(9, HIGH); // Turn left

for(double i = 0; i < 100000; i++) { //100000 steps in one direction
digitalWrite(10, HIGH);
delay(1);
digitalWrite(10, LOW);
delay(1);
}
digitalWrite(11, LOW); // Motor Off

delay(5000);
}

it works perfect with Arduino Uno R3, but not with Arduino Leonardo!
Can someone help me? What's the problem?

kricom

I'm not sure what your problem is, but double is not a type I'd use as a loop control like that.
Try "long" or "unsigned long"

Also, it is best if you post all your code. What you posted is not a sketch.

Please use code tags when posting code

the type is not the problem!
here is all the code:

void setup() { 
  pinMode(9, OUTPUT);       // Motor Dir
  pinMode(10, OUTPUT);     // Motor Step
  pinMode(11, OUTPUT);     // Motor On - Off
  digitalWrite(11, LOW);     // Motor Off = LOW
}

void loop() {
  Pololu_A4988_Example();
}

void Pololu_A4988_Example(){
         
  digitalWrite(11, HIGH);   // Motor On
  delay(500);                   // delay for Controller startup
  digitalWrite(9, LOW);     // Turn right
   
  for(double i = 0; i < 100000; i++) {     //100000 steps in one direction
    digitalWrite(10, HIGH);
    delay(1);
    digitalWrite(10, LOW);
    delay(1);
  }
  digitalWrite(11, LOW);    // Motor Off
 
  delay(5000);
   
  digitalWrite(11, HIGH);    // Motor On
  delay(500);                    // delay for Controller startup
  digitalWrite(9, HIGH);     // Turn left

  for(double i = 0; i < 100000; i++) {   //100000 steps in one direction
    digitalWrite(10, HIGH);
    delay(1);
    digitalWrite(10, LOW);
    delay(1);
  }
  digitalWrite(11, LOW);    // Motor Off
 
  delay(5000);
}

the type is not the problem!

It isn't the problem...yet.

Now what does the code do that it shouldn't and what doesn't it do that it should?