Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. // definiert die Pins zum Steppertreiber (Singal)
  2. const int stepPin = 5; //Stepper
  3. const int dirPin = 2; //Stepper
  4. const int enPin = 8; //Stepper
  5.  
  6. const int stepPin1 = 6; //Stepper
  7. const int dirPin1 = 3; //Stepper
  8. const int enPin1 = 9; //Stepper;
  9.  
  10. void setup() //Hier beginnt das Setup.
  11. {
  12. pinMode(stepPin,OUTPUT); //Stepper
  13. pinMode(dirPin,OUTPUT); //Stepper
  14.  
  15. pinMode(enPin,OUTPUT); //Stepper
  16. digitalWrite(enPin,LOW); //Stepper
  17.  
  18. pinMode(stepPin1,OUTPUT); //Stepper
  19. pinMode(dirPin1,OUTPUT); //Stepper
  20.  
  21. pinMode(enPin1,OUTPUT); //Stepper
  22. digitalWrite(enPin1,LOW); //Stepper
  23.  
  24.  
  25.  
  26. pinMode(11, OUTPUT);//Motor Sägen
  27.  
  28.  
  29.  
  30. }
  31.  
  32.  
  33.  
  34. void loop() // Schleife
  35.  
  36.  
  37. {
  38.  
  39. //----------------------------Schritt 1 ----------------------------
  40.  
  41. digitalWrite (11, LOW); // Motor Säge an
  42.  
  43. digitalWrite(dirPin,HIGH); // Drehrichtung High oder LOW
  44.  
  45. for(int x = 0; x < 1000; x++) {
  46. digitalWrite(stepPin,HIGH);
  47. delayMicroseconds(1200); // Steps die gemacht werden sollen
  48. digitalWrite(stepPin,LOW);
  49. delayMicroseconds(1200);}
  50.  
  51. delay(1000); // 1 Sekunde warten
  52.  
  53. digitalWrite(dirPin,LOW);
  54. for(int x = 0; x < 1000; x++) {
  55. digitalWrite(stepPin,HIGH);
  56. delayMicroseconds(500); // Steps die gemacht werden sollen
  57. digitalWrite(stepPin,LOW);
  58. delayMicroseconds(500);}
  59.  
  60. digitalWrite (11,HIGH); // Motor Säge aus
  61.  
  62. delay(500); // Halbe Sekunde warten
  63.  
  64.  
  65.  
  66.  
  67.  
  68. //---------------------------Schritt 2--------------------------
  69.  
  70. digitalWrite(dirPin1,HIGH); // Enables the motor to move in a particular direction
  71. // Makes 200 pulses for making one full cycle rotation
  72. for(int x = 0; x < 200; x++) {
  73. digitalWrite(stepPin1,HIGH);
  74. delayMicroseconds(500);
  75. digitalWrite(stepPin1,LOW);
  76. delayMicroseconds(500);}
  77.  
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement