Différences
Ci-dessous, les différences entre deux révisions de la page.
| 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.... | + | int speedoH = 100; //micro s entre les pas... |
| - | int speedoM = 220; | + | int speedoM = 100; |
| void setup() { | void setup() { | ||
| - | Serial.begin(9600); | ||
| pinMode(enPin, | pinMode(enPin, | ||
| digitalWrite(enPin, | digitalWrite(enPin, | ||
| - | Serial.println(F("CNC Shield Initialized" | + | |
| + | digitalWrite(dirYPin, HIGH); // Enables the motor to move in a particular direction | ||
| + | digitalWrite(dirXPin, | ||
| } | } | ||
| void loop() { | void loop() { | ||
| - | | + | for (int i = 0; i < nombredepasM; i++) { |
| - | digitalWrite(dirYPin, | + | |
| - | digitalWrite(dirXPin, | + | |
| - | // Makes 200 pulses for making one full cycle rotation | + | |
| - | | + | |
| digitalWrite(stepYPin, | digitalWrite(stepYPin, | ||
| delayMicroseconds(speedoM); | delayMicroseconds(speedoM); | ||
| Ligne 51: | Ligne 49: | ||
| delayMicroseconds(speedoM*10); | delayMicroseconds(speedoM*10); | ||
| } | } | ||
| - | + | | |
| - | | + | |
| digitalWrite(stepXPin, | digitalWrite(stepXPin, | ||
| delayMicroseconds(speedoH); | delayMicroseconds(speedoH); | ||
| Ligne 59: | Ligne 56: | ||
| } | } | ||
| } | } | ||
| + | |||
| </ | </ | ||