Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int x;
- #define Stepx 3
- #define Dirx 2
- #define Enx 6 // 38
- // -------------------------------------------
- void setup()
- {
- pinMode(Enx,OUTPUT); // Enable
- pinMode(Stepx,OUTPUT); // Step
- pinMode(Dirx,OUTPUT); // Dir
- digitalWrite(Enx,LOW); // Set Enable low
- }
- // -------------------------------------------
- void loop()
- {
- digitalWrite(Dirx,HIGH); // Set Dir high
- for(x = 0; x < 200; x++) // Loop 200 times
- {
- digitalWrite(Stepx,HIGH); // Output high
- delayMicroseconds(500); // Wait 1/2 a ms
- digitalWrite(Stepx,LOW); // Output low
- delayMicroseconds(500); // Wait 1/2 a ms
- }
- delay(1000); // pause one second
- digitalWrite(Dirx,LOW); // Set Dir low
- for(x = 0; x < 200; x++) // Loop 2000 times
- {
- digitalWrite(Stepx,HIGH); // Output high
- delayMicroseconds(500); // Wait 1/2 a ms
- digitalWrite(Stepx,LOW); // Output low
- delayMicroseconds(500); // Wait 1/2 a ms
- }
- delay(1000); // pause one second
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement