Advertisement
RuiViana

Teste

Mar 5th, 2016
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #define Step 9 // Clk+
  2. #define Dir 8 // Cw+
  3. #define leitura 3 // botao
  4. unsigned int Qtde_Steps = 50;
  5. unsigned int velocity = 100;
  6.  
  7. //--------------------------------------------
  8. void setup()
  9. {
  10. Serial.begin(9600);
  11. pinMode(leitura, INPUT_PULLUP);
  12. pinMode(Dir, OUTPUT);
  13. pinMode(Step, OUTPUT);
  14. digitalWrite(Dir, LOW);
  15. digitalWrite(Step, LOW);
  16. digitalWrite(Dir, HIGH);
  17. }
  18. //---------------------------------------------
  19. void loop()
  20. {
  21. // if (leitura == LOW)
  22. // {
  23. for ( int i = 0; i < 50 ; i++)
  24. {
  25. digitalWrite(Step, HIGH);
  26. delayMicroseconds(100);
  27. digitalWrite(Step, LOW);
  28. delayMicroseconds(100);
  29. }
  30. // }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement