Advertisement
RuiViana

Untitled

Jun 9th, 2015
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. int x;
  2. // -------------------------------------------
  3. void setup()
  4. {
  5. pinMode(6,OUTPUT); // Enable
  6. pinMode(5,OUTPUT); // Step
  7. pinMode(4,OUTPUT); // Dir
  8. digitalWrite(6,LOW); // Set Enable low
  9. }
  10. // -------------------------------------------
  11. void loop()
  12. {
  13. digitalWrite(4,HIGH); // Set Dir high
  14. for(x = 0; x < 200; x++) // Loop 200 times
  15. {
  16. digitalWrite(5,HIGH); // Output high
  17. delayMicroseconds(500); // Wait 1/2 a ms
  18. digitalWrite(5,LOW); // Output low
  19. delayMicroseconds(500); // Wait 1/2 a ms
  20. }
  21. delay(1000); // pause one second
  22. digitalWrite(4,LOW); // Set Dir low
  23. for(x = 0; x < 200; x++) // Loop 2000 times
  24. {
  25. digitalWrite(5,HIGH); // Output high
  26. delayMicroseconds(500); // Wait 1/2 a ms
  27. digitalWrite(5,LOW); // Output low
  28. delayMicroseconds(500); // Wait 1/2 a ms
  29. }
  30. delay(1000); // pause one second
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement