Bonsoir,
S'il vous plait, j'ai un robot voiture avec 4 moteurs, 2 moteurs represente moteur A et les 2 autres represente moteur B
Et il y'a un probleme dans la programmation du arduino avec logiciel arduino ide
Où les 2 moteurs A fonctionne et les autres non
Voici le programme
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Définition des broches du moteur gauche
const int IN1 = 8;
const int IN2 = 7;
const int ENA = 9;
 
// Définition des broches du moteur droit
const int IN3 = 4;
const int IN4 = 5;
const int ENB = 3;
 
 
 
void setup() {
  // Configuration des broches en sortie
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(ENA, OUTPUT);
 
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  pinMode(ENB, OUTPUT);
}
 
void loop() {
  // Marche avant des deux moteurs
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
 
  // Accélération progressive des deux moteurs
  for (int i = 0; i < 256; i++) {
    analogWrite(ENA, i); // Moteur gauche
    analogWrite(ENB, i); // Moteur droit
    delay(10); // Douceur du mouvement
  }
 
  // Décélération progressive
  for (int i = 255; i >= 0; i--) {
    analogWrite(ENA, i);
    analogWrite(ENB, i);
    delay(10);
  }
}
Je veux une solution.
Merci