Advertisement
Guest User

troubleboi

a guest
Aug 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. // Define Arduino pins for STEP and DIRECTION
  2. const int dirPin = 8;
  3. const int stepPin = 9;
  4.  
  5. //Define delays between commands, you can play with these
  6. const int delayStepCommandInMicroSeconds = 50; // Time STEP will be HIGH (pulse)
  7. const int delayBetweenStepInMicroSeconds = 1200; // Time STEP will be LOW
  8.  
  9. void setup() {
  10. pinMode( stepPin, OUTPUT);
  11. pinMode( dirPin, OUTPUT);
  12.  
  13. for( int x = 0; x < 200; x++ ) {
  14. digitalWrite( stepPin, HIGH );
  15. delayMicroseconds( delayStepCommandInMicroSeconds );
  16. digitalWrite( stepPin, LOW );
  17. delayMicroseconds( delayBetweenStepInMicroSeconds );
  18. }
  19.  
  20. //Wait one second in a standstill and start over from top
  21. delay(1000);
  22.  
  23.  
  24.  
  25.  
  26. }
  27.  
  28. void loop() {
  29.  
  30. // Enables the motor to move in a particular direction
  31. // Remove // to change motor direction
  32. // digitalWrite( dirPin, HIGH );
  33.  
  34. // make 200 pulses which correspond to 360
  35. // degrees (one full rotation) when using
  36. // 1.8 step degree motor in full-step mode
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement