Advertisement
Guest User

stepper tests

a guest
May 24th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1.  
  2. /*
  3. Stepper Motor Control - one revolution
  4.  
  5. This program drives a unipolar or bipolar stepper motor.
  6. The motor is attached to digital pins 8 - 11 of the Arduino.
  7.  
  8. The motor should revolve one revolution in one direction, then
  9. one revolution in the other direction.
  10.  
  11.  
  12. Created 11 Mar. 2007
  13. Modified 30 Nov. 2009
  14. by Tom Igoe
  15.  
  16. */
  17.  
  18. #include <Stepper.h>
  19.  
  20. const int stepsPerRevolution = 800; // change this to fit the number of steps per revolution
  21. // for your motor
  22. //5080 steps is about 2 inches
  23. // initialize the stepper library on pins 8 through 11:
  24. Stepper stepperX(stepsPerRevolution, 3, 6);
  25. Stepper stepperY(stepsPerRevolution, 2, 5);
  26.  
  27. void setup() {
  28. // // set the speed at 60 rpm:
  29. // stepperX.setSpeed(200);
  30. // // initialize the serial port:
  31. // Serial.begin(9600);
  32. // stepperX.step(stepsPerRevolution);
  33. // set the speed at 60 rpm:
  34. stepperY.setSpeed(200);
  35. // initialize the serial port:
  36. Serial.begin(9600);
  37. stepperY.step(4*2540);
  38. }
  39.  
  40. void loop() {
  41. // // step one revolution in one direction:
  42. // Serial.println("clockwise");
  43. // myStepper.step(stepsPerRevolution);
  44. // delay(500);
  45.  
  46. // // step one revolution in the other direction:
  47. // Serial.println("counterclockwise");
  48. // myStepper.step(-stepsPerRevolution);
  49. // delay(500);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement