Différences entre versions de « Pololu-Zumo-Shield-Arduino-servo-leonardo »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 3 : Ligne 3 :
 
{{traduction}}
 
{{traduction}}
  
It is possible to modify the Servo library that comes with the Arduino IDE to use Timer 3 instead of Timer 1 on the Arduino Leonardo or A-Star 32U4 Prime. The modified Servo library does not interfere with the ZumoMotors library, making it possible to simultaneously control servos and the motors.
+
Il est possible de modifier la bibliothèque Servo distribué avec Arduino IDE pour utiliser le Timer 3 à la place du Timer 1 sur Arduino Leonardo ou A-Star 32U4 Prime. La bibliothèque Servo modifiée n'interfère pas avec la bibliothèque ZumoMotors permettant de contrôler simultanément des servos et les moteurs.
  
{{ambox-stop|text=Warning: The modifications described here will affect any sketch for the Arduino Leonardo or A-Star that uses the Servo library.}}
+
{{ambox-stop|text=Attention: les modifications décrites ici affecte tous les croquis/sketchs de vos Arduino Leonardo ou A-Star utilisant la bibliothèque Servo.}}
  
1. First, you will need to locate the Arduino IDE’s Servo library, and find the file inside it named ServoTimers.h. For the 1.6.x versions of the IDE, this file can be found in libraries/Servo/src/avr/ServoTimers.h. If you are using Mac OS X, you will need to right-click on the Arduino IDE icon and select “Show Package Contents” to see the files inside.
+
1. Pour commencer, vous aurez besoin de localiser l'emplacement de votre bibliothèque Servo d'Arduino IDE PUIS localiser le fichier nommé {{fname|ServoTimers.h}}. Dans Arduino IDE 1.6.x ce fichier peut être trouvé dans da le répertoire {{fname|libraries/Servo/src/avr/ServoTimers.h}} . Si vous utiliser Mac OS X, il sera nécessaire de faire un clique droit sur l'icône Arduino IDE puis sélectionner "Show Package Contents" pour vois les fichiers à l'intérieur.
  
2. Open ServoTimers.h in a text editor.
+
2. Ouvrez le fichier {{fname|ServoTimers.h}} avec un éditeur de texte.
  
3. Locate the following lines of code in ServoTimers.h:
+
3. Cherchez les lignes suivantes dans le code de ServoTimers.h:
  
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
Ligne 19 : Ligne 19 :
 
</syntaxhighlight>
 
</syntaxhighlight>
  
4. The lower two lines of code specify that the library should use Timer 1. To use Timer 3 instead, just change _useTimer1 to _useTimer3 and _timer1 to _timer3.
+
4. Les deux dernières lignes de code indique la bibliothèque devrait utiliser le Timer 1.<br />Pour utiliser le Timer 3 à la place, changer simplement le _useTimer1 vers _useTimer3 -ET- _timer1 vers _timer3.
  
5. Save the file.
+
5. Sauvez le fichier.
  
 
The Arduino IDE will automatically incorporate your modifications to the Servo library. The next time you compile a sketch for the Arduino Leonardo or A-Star that uses the Servo library, it will use Timer 3 instead of Timer 1.
 
The Arduino IDE will automatically incorporate your modifications to the Servo library. The next time you compile a sketch for the Arduino Leonardo or A-Star that uses the Servo library, it will use Timer 3 instead of Timer 1.
 +
 
{{Pololu-Zumo-Shield-Arduino-TRAILER}}
 
{{Pololu-Zumo-Shield-Arduino-TRAILER}}

Version du 17 avril 2017 à 16:52

Il est possible de modifier la bibliothèque Servo distribué avec Arduino IDE pour utiliser le Timer 3 à la place du Timer 1 sur Arduino Leonardo ou A-Star 32U4 Prime. La bibliothèque Servo modifiée n'interfère pas avec la bibliothèque ZumoMotors permettant de contrôler simultanément des servos et les moteurs.

1. Pour commencer, vous aurez besoin de localiser l'emplacement de votre bibliothèque Servo d'Arduino IDE PUIS localiser le fichier nommé ServoTimers.h. Dans Arduino IDE 1.6.x ce fichier peut être trouvé dans da le répertoire libraries/Servo/src/avr/ServoTimers.h . Si vous utiliser Mac OS X, il sera nécessaire de faire un clique droit sur l'icône Arduino IDE puis sélectionner "Show Package Contents" pour vois les fichiers à l'intérieur.

2. Ouvrez le fichier ServoTimers.h avec un éditeur de texte.

3. Cherchez les lignes suivantes dans le code de ServoTimers.h:

#elif defined(__AVR_ATmega32U4__)  
#define _useTimer1 
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;

4. Les deux dernières lignes de code indique la bibliothèque devrait utiliser le Timer 1.
Pour utiliser le Timer 3 à la place, changer simplement le _useTimer1 vers _useTimer3 -ET- _timer1 vers _timer3.

5. Sauvez le fichier.

The Arduino IDE will automatically incorporate your modifications to the Servo library. The next time you compile a sketch for the Arduino Leonardo or A-Star that uses the Servo library, it will use Timer 3 instead of Timer 1.


Basé sur "Zumo Shield for Arduino" de Pololu (www.pololu.com/docs/0J57) - Traduit en Français par shop.mchobby.be CC-BY-SA pour la traduction
Toute copie doit contenir ce crédit, lien vers cette page et la section "crédit de traduction". Traduit avec l'autorisation expresse de Pololu (www.pololu.com)

Based on "Zumo Shield for Arduino" from Pololu (www.pololu.com/docs/0J57) - Translated to French by shop.mchobby.be CC-BY-SA for the translation
Copies must includes this credit, link to this page and the section "crédit de traduction" (translation credit). Translated with the Pololu's authorization (www.pololu.com)