Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // definiert die Pins zum Steppertreiber (Singal)
- const int stepPin = 5; //Stepper
- const int dirPin = 2; //Stepper
- const int enPin = 8; //Stepper
- const int stepPin1 = 6; //Stepper
- const int dirPin1 = 3; //Stepper
- const int enPin1 = 9; //Stepper;
- void setup() //Hier beginnt das Setup.
- {
- pinMode(stepPin,OUTPUT); //Stepper
- pinMode(dirPin,OUTPUT); //Stepper
- pinMode(enPin,OUTPUT); //Stepper
- digitalWrite(enPin,LOW); //Stepper
- pinMode(stepPin1,OUTPUT); //Stepper
- pinMode(dirPin1,OUTPUT); //Stepper
- pinMode(enPin1,OUTPUT); //Stepper
- digitalWrite(enPin1,LOW); //Stepper
- pinMode(11, OUTPUT);//Motor Sägen
- }
- void loop() // Schleife
- {
- //----------------------------Schritt 1 ----------------------------
- digitalWrite (11, LOW); // Motor Säge an
- digitalWrite(dirPin,HIGH); // Drehrichtung High oder LOW
- for(int x = 0; x < 1000; x++) {
- digitalWrite(stepPin,HIGH);
- delayMicroseconds(1200); // Steps die gemacht werden sollen
- digitalWrite(stepPin,LOW);
- delayMicroseconds(1200);}
- delay(1000); // 1 Sekunde warten
- digitalWrite(dirPin,LOW);
- for(int x = 0; x < 1000; x++) {
- digitalWrite(stepPin,HIGH);
- delayMicroseconds(500); // Steps die gemacht werden sollen
- digitalWrite(stepPin,LOW);
- delayMicroseconds(500);}
- digitalWrite (11,HIGH); // Motor Säge aus
- delay(500); // Halbe Sekunde warten
- //---------------------------Schritt 2--------------------------
- digitalWrite(dirPin1,HIGH); // Enables the motor to move in a particular direction
- // Makes 200 pulses for making one full cycle rotation
- for(int x = 0; x < 200; x++) {
- digitalWrite(stepPin1,HIGH);
- delayMicroseconds(500);
- digitalWrite(stepPin1,LOW);
- delayMicroseconds(500);}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement