Advertisement
RuiViana

Testa_Step.ino

Jul 7th, 2021
1,189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1.  
  2. #define stepX 13
  3. #define dirX  12
  4. int nVoltas = 10;
  5. int tempo = 1000;
  6. //   -------------------------------------------
  7. void setup()
  8. {
  9.   pinMode(stepX, OUTPUT);          // Step
  10.   pinMode(dirX, OUTPUT);           // Dir
  11. }
  12. //   -------------------------------------------
  13. void loop()
  14. {
  15.     for (unsigned long x = 0; x < nVoltas * 200; x++)              
  16.     {
  17.       digitalWrite(stepX, HIGH);              // Output high
  18.       delayMicroseconds(tempo);                           // Wait
  19.       digitalWrite(stepX, LOW);               // Output low
  20.       delayMicroseconds(tempo);                           // Wait
  21.       Serial.println(x);
  22.     }
  23.   delay(2000);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement