SHARE
TWEET

Untitled

a guest Apr 21st, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Arduino stepper motor control code
  2.  
  3. #include <Stepper.h> // Include the header file
  4.  
  5. // change this to the number of steps on your motor
  6. const int STEPS = 600;
  7.  
  8. // create an instance of the stepper class using the steps and pins
  9. Stepper stepper(STEPS, 8, 10, 9, 11);
  10.  
  11.  
  12.  
  13. void setup() {
  14.   stepper.setSpeed(60);
  15.   Serial.begin(9600);
  16.  
  17. }
  18.  
  19. void loop() {
  20.   Serial.println("clockwise");
  21.   stepper.step(STEPS);
  22.   delay(500);
  23.  
  24.   Serial.println("counterclockwise");
  25.   stepper.step(-STEPS);
  26.   delay(500);
  27.  
  28.  
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top