tout cramé? July 15, 2012 04:14AM |
Registered: 11 years ago Posts: 11 |
Re: tout cramé? July 15, 2012 10:21AM |
Registered: 13 years ago Posts: 352 |
Re: tout cramé? July 15, 2012 11:21AM |
Registered: 11 years ago Posts: 11 |
Re: tout cramé? July 15, 2012 11:33AM |
Registered: 11 years ago Posts: 45 |
#define X_STEP_PIN 54 #define X_DIR_PIN 55 #define X_ENABLE_PIN 38 #define Y_STEP_PIN 60 #define Y_DIR_PIN 61 #define Y_ENABLE_PIN 56 #define Z_STEP_PIN 46 #define Z_DIR_PIN 48 #define Z_ENABLE_PIN 62 #define E_STEP_PIN 26 #define E_DIR_PIN 28 #define E_ENABLE_PIN 24 const int stepPin = X_STEP_PIN; // à modifier en conséquence const int dirPin = X_DIR_PIN; //ici aussi const int enablePin = X_ENABLE_PIN; //et là aussi void setup() { Serial.begin(9600); Serial.println("Starting stepper exerciser."); pinMode(stepPin, OUTPUT); pinMode(dirPin, OUTPUT); digitalWrite(dirPin, HIGH); digitalWrite(stepPin, LOW); pinMode(enablePin, OUTPUT); digitalWrite(enablePin, LOW); } void loop() { int i, j; for (i=1000; i>=200; i-=100) { Serial.print("Speed: "); Serial.println(i); for (j=0; j<2000; j++) { digitalWrite(stepPin, HIGH); delayMicroseconds(i); digitalWrite(stepPin, LOW); delayMicroseconds(i); } delay(500); digitalWrite(dirPin, !digitalRead(dirPin)); for (j=0; j<2000; j++) { digitalWrite(stepPin, HIGH); delayMicroseconds(i); digitalWrite(stepPin, LOW); delayMicroseconds(i); } delay(1000); Serial.println("Switching directions."); digitalWrite(dirPin, !digitalRead(dirPin)); } }
Re: tout cramé? July 16, 2012 12:12PM |
Registered: 11 years ago Posts: 11 |