projets:horloge_qi:start

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
projets:horloge_qi:start [2023/02/28 21:42]
enseignant
projets:horloge_qi:start [2023/03/01 09:48] (Version actuelle)
admin [Notes techniques et matériaux]
Ligne 20: Ligne 20:
 Engrenage courroie et mecanique diverse Engrenage courroie et mecanique diverse
  
-<code c>const int enPin=8;+<code c> 
 +const int enPin=8;
 const int stepXPin = 2; //X.STEP const int stepXPin = 2; //X.STEP
 const int dirXPin = 5; // X.DIR const int dirXPin = 5; // X.DIR
Ligne 28: Ligne 29:
 const int dirZPin = 7; // Z.DIR const int dirZPin = 7; // Z.DIR
  
-const int stepsPerRevH=600+const int nombredepasH=120// rapport 60  heure 
-const int stepsPerRevM=10;+const int nombredepasM=2;
  
-int speedoH = 220; // vitesse du moteur....   calcul : 60000*8/200(x*10x) +int speedoH = 100; //micro s entre les pas... 
-int speedoM = 220;+int speedoM = 100;
  
 void setup() { void setup() {
-  Serial.begin(9600); 
   pinMode(enPin, OUTPUT);   pinMode(enPin, OUTPUT);
   digitalWrite(enPin, LOW);   digitalWrite(enPin, LOW);
-  Serial.println(F("CNC Shield Initialized"));+ 
 +  digitalWrite(dirYPin, HIGH); // Enables the motor to move in a particular direction 
 +  digitalWrite(dirXPin, LOW); // Enables the motor to move in a particular direction
 } }
 void loop() { void loop() {
-  //Serial.println(F("Running clockwise")); +  for (int i = 0; i < nombredepasM; i++) {
-  digitalWrite(dirYPin, HIGH); // Enables the motor to move in a particular direction +
-  digitalWrite(dirXPin, HIGH); // Enables the motor to move in a particular direction +
-  // Makes 200 pulses for making one full cycle rotation +
-  for (int i = 0; i < stepsPerRevM; i++) {+
       digitalWrite(stepYPin, HIGH);       digitalWrite(stepYPin, HIGH);
       delayMicroseconds(speedoM);       delayMicroseconds(speedoM);
Ligne 51: Ligne 49:
       delayMicroseconds(speedoM*10);       delayMicroseconds(speedoM*10);
   }   }
- +    for (int i = 0; i < nombredepasH; i++) {
-    for (int i = 0; i < stepsPerRevH; i++) {+
       digitalWrite(stepXPin, HIGH);       digitalWrite(stepXPin, HIGH);
       delayMicroseconds(speedoH);       delayMicroseconds(speedoH);
Ligne 59: Ligne 56:
   }   }
 } }
 +
 </code> </code>
  
  • projets/horloge_qi/start.1677616930.txt.gz
  • Dernière modification: 2023/02/28 21:42
  • de enseignant