Guest User

printrboard stepper example

a guest
Feb 5th, 2019
73
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Arduino.h>
  2. #include "BasicStepperDriver.h"
  3.  
  4. #define DIR 33
  5. #define STEP 32
  6. #define SLEEP 17
  7. int RPM = 200;
  8. #define MICROSTEPS 16
  9.  
  10. BasicStepperDriver stepper(400, DIR, STEP);
  11.  
  12. void setup() {
  13.   //set pinmode for sleep pin
  14.   pinMode(SLEEP, OUTPUT);
  15.   stepper.setRPM(RPM);
  16.   stepper.begin(RPM, MICROSTEPS);
  17.  
  18.   //enable motor
  19.   digitalWrite(SLEEP, LOW);
  20. }
  21.  
  22. void loop() {
  23.   stepper.move(400*MICROSTEPS);
  24.   delay(5000);
  25. }
RAW Paste Data