int x;
void setup()
{
pinMode(6OUTPUT); // Enable
pinMode(5OUTPUT); // Step
pinMode(4OUTPUT); // Dir
digitalWrite(6LOW); // Set Enable low
}
void loop()
{
digitalWrite(4HIGH); // Set Dir high
for(x = 0; x < 200; x++) // Loop 200 times
{
digitalWrite(5HIGH); // Output high
delayMicroseconds(800); // Wait 1/2 a ms
digitalWrite(5LOW); // Output low
delayMicroseconds(800); // Wait 1/2 a ms
}
delay(1000); // pause one second
digitalWrite(4LOW); // Set Dir low
for(x = 0; x < 200; x++) // Loop 2000 times
{
digitalWrite(5HIGH); // Output high
delayMicroseconds(800); // Wait 1/2 a ms
digitalWrite(5LOW); // Output low
delayMicroseconds(800); // Wait 1/2 a ms
}
delay(1000); // pause one second
}