Modifications

Sauter à la navigation Sauter à la recherche
1 061 octets ajoutés ,  22 décembre 2012 à 14:49
Ligne 119 : Ligne 119 :  
[[Fichier:ADF-MOTOR-SHIELD-USE-MOTEURCC.jpg]]
 
[[Fichier:ADF-MOTOR-SHIELD-USE-MOTEURCC.jpg]]
   −
DC motors are used for all sort of robotic projects. The motor shield can drive up to 4 DC motors bi-directionally. That means they can be driven forwards and backwards. The speed can also be varied at 0.5% increments using the high-quality built in PWM. This means the speed is very smooth and won't vary!
+
Les moteur à courant continu (CC ou "DC" en anglais) sont utilisés dans toutes sortes de projet robotique. Le shield moteur est capable de controler jusqu'à 4 moteurs bi-directionnels. Cela signifie qu'il peuvent fonctionner en marche avant et marche arrière. La vitesse peut également varier d'un incrément de 0.5% grace à l'utilisation d'un signal PWM de grande précision. Cela signifie que la vitesse reste constance et ne variera pas!
   −
Note that the H-bridge chip is not really meant for driving loads over 0.6A or that peak over 1.2A so this is for small motors. Check the datasheet for information about the motor to verify its OK.
+
Notez que le circuit Pont-H n'est pas conçu pour contrôler un courant supérieur à 600 mA  (ou un pic supérieur à 1.2A), il convient donc pour les "petits" moteurs. Vérifiez la fiche technique de vos moteurs pour vous assurer qu'ils conviennent bien.
   −
To connect a motor, simply solder two wires to the terminals and then connect them to either the '''M1, M2, M3,''' or '''M4'''. Then follow these steps in your sketch
+
Pour connecter un moteur, soudez simplement deux fils sur les bornes du moteur et connectez les ensuite sur l'un des borniers '''M1, M2, M3,''' ou '''M4''' (au choix).
    +
Exécutez ensuite les étapes suivantes dans votre sketch Arduino
   −
# Make sure you include <AFMotor.h>
+
 
# Create the AF_DCMotor object with '''AF_DCMotor(motor#, frequency)''', to setup the motor H-bridge and latches. The constructor takes two arguments.<br />The first is which port the motor is connected to, '''1, 2, 3''' or '''4'''.<br />''' ''frequency''' '' is how fast the speed controlling signal is.<br />For motors 1 and 2 you can choose '''MOTOR12_64KHZ, MOTOR12_8KHZ, MOTOR12_2KHZ''', or '''MOTOR12_1KHZ'''. A high speed like 64KHz wont be audible but a low speed like 1KHz will use less power. Motors 3 & 4 are only possible to run at 1KHz and will ignore any setting given
+
# Assurez vous d'avoir inclus <AFMotor.h>
# Then you can set the speed of the motor using '''setSpeed(speed)''' where the ''speed'' ranges from 0 (stopped) to 255 (full speed). You can set the speed whenever you want.
+
# Créez un objet AF_DCMotor avec '''AF_DCMotor(numéro_motor, fréquence)''', pour initialiser le pont-H et les latch. <br />Le constructeur accepte deux arguments.<br />Le premier est le port (bornier) sur lequel le moteur est connecté ('''1, 2, 3''' ou '''4''').<br />''' ''fréquence''' '' est la rapidité du signal contrôlant la vitesse.<br />Pour les moteurs 1 et 2 vous pouvez opter pour '''MOTOR12_64KHZ, MOTOR12_8KHZ, MOTOR12_2KHZ''', ou '''MOTOR12_1KHZ'''. Un signal à haute vitesse comme 64KHz ne sera pas audible mais une signal basse vitesse tel que 1KHz nécessitera moins de puissance.<br />Les Moteurs 3 et 4 peuvent uniquement fonctionner avec un signal à 1KHz et ignorerons donc le paramètre fournit.
# To run the motor, call '''run(direction)''' where direction is '''FORWARD, BACKWARD''' or '''RELEASE'''. Of course, the Arduino doesn't actually know if the motor is 'forward' or 'backward', so if you want to change which way it thinks is forward, simply swap the two wires from the motor to the shield.
+
# Ensuite, vous pouvez sélectionner la vitesse du moteur en utilisant '''setSpeed(vitesse)''' ''vitesse'' est compris entre 0 (arrêt) et 255 (pleine vitesse). Vous pouvez modifier la vitesse à n'importe quel moment.
 +
# Pour mettre le moteur en route, appelez la fonction '''run(sens_rotation)''' où sens_rotation est '''FORWARD''' pour avant, '''BACKWARD''' pour arrière ou ''RELEASE''' (arrêt).<br />Notez que l'arrêt utilise le terme anglais 'RELEASE' qui à plutôt le sens de "relâché". C'est normal puisque le moteur n'est plus contrôlé sans pour autant être bloqué/verrouillé à l'arrêt... il peut en effet encore être entraîner à la main :-).<br />Pour le reste, gardez à l'esprit qu'Arduino ne sait pas si votre moteur est cablé dans un sens ou dans l'autre... et ne sait donc pas à quoi correspond la marche avant (forward) ou la marche arrière (backward) de votre montage. Si votre montage fonctionne en marche arrière avec l'instruction '''run(FORWARD)''', il suffit d'inverser les fils de raccordement du moteur sur le bornier du shield moteur.
    
  <nowiki>#include <AFMotor.h>
 
  <nowiki>#include <AFMotor.h>
   −
AF_DCMotor motor(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
+
AF_DCMotor motor(2, MOTOR12_64KHZ); // Créer le moteur #2, PWM à 64KHz
    
void setup() {
 
void setup() {
   Serial.begin(9600);          // set up Serial library at 9600 bps
+
   Serial.begin(9600);          // Initialiser la communication série à 9600 bauds
   Serial.println("Motor test!");
+
   Serial.println("Test Moteur!");
 
    
 
    
   motor.setSpeed(200);    // set the speed to 200/255
+
   motor.setSpeed(200);    // Mettre la vitesse à 200 (max 255)
 
}
 
}
   Ligne 145 : Ligne 147 :  
   Serial.print("tick");
 
   Serial.print("tick");
 
    
 
    
   motor.run(FORWARD);      // turn it on going forward
+
   motor.run(FORWARD);      // mettre en marche avant (forward)
 
   delay(1000);
 
   delay(1000);
    
   Serial.print("tock");
 
   Serial.print("tock");
   motor.run(BACKWARD);    // the other way
+
   motor.run(BACKWARD);    // Dans l'autre sens
 
   delay(1000);
 
   delay(1000);
 
    
 
    
 
   Serial.print("tack");
 
   Serial.print("tack");
   motor.run(RELEASE);      // stopped
+
   motor.run(RELEASE);      // Arrêt
 
   delay(1000);
 
   delay(1000);
 
}</nowiki>
 
}</nowiki>
29 917

modifications

Menu de navigation