Advertisement
Makerino

Stepper Motor

May 5th, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. /*
  2.  * Anschlussbelegung:
  3.  *
  4.  * Arduino        Motor
  5.  * D3              in4
  6.  * D4              in3
  7.  * D5              in2
  8.  * D6              in1
  9.  * 5V               +
  10.  * Gnd              -
  11.  *
  12.  */
  13.  
  14. #include <Stepper.h>
  15. int SpU = 2048;           //SpU = Steps pro Umdrehung
  16. Stepper SM(SpU, 3,5,4,6);
  17.  
  18. void setup(){
  19. SM.setSpeed(5);
  20. }
  21.  
  22. void loop() {
  23. SM.step(2048);
  24. delay(1000);
  25. SM.step(-2048);
  26. delay(1000);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement