Modifications

Sauter à la navigation Sauter à la recherche
180 octets ajoutés ,  16 novembre 2019 à 22:07
aucun résumé de modification
Ligne 1 : Ligne 1 :  
{{Pololu-Romi-32U4-NAV}}
 
{{Pololu-Romi-32U4-NAV}}
   −
{{traduction}}
+
== Contrôler des servos ==
 +
Il est possible de modifier la bibliothèque Servo d'Arduino IDE pour utiliser le Timer 3 à la place du Timer 1 avec une carte à base d'ATmega32U4 comme le Romi 32U4.
   −
== Contrôler des servos ==
+
La bibliothèque Servo modifiée n'interfère pas avec {{fname|Romi32U4Motors}} permettant ainsi de contrôler simultanément des servos et les moteurs.
It is possible to modify the Servo library that comes with the Arduino IDE to use Timer 3 instead of Timer 1 with an ATmega32U4 based controller like the Romi 32U4. The modified Servo library does not interfere with Romi32U4Motors, making it possible to simultaneously control servos and the motors.
     −
{{ambox-stop|text=Warning: The modifications described here will affect any sketch for an ATmega32U4 based controller that uses the Servo library, including the Arduino Leonardo or A-Star.}}
+
{{ambox-stop|text=Attention: la modification décrite ici affectera toutes tous les croquis pour les contrôleurs basés sur un ATmega32U4 qui utilise la bibliothèque Servo, incluant Arduino Leonardo ou Pololu A-Star.}}
   −
# 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.
+
# Pour commencer, il sera nécessaire de localisé le répertoire de la bibliothèque Servo d'Arduino IDE. Ensuite, ouvrir le fichier {{fname|ServoTimers.h}}. Pour la version 1.6.x de l'IDE, ce fichier peut être trouvé dans {{fname|libraries/Servo/src/avr/ServoTimers.h}}. Si vous utilisez Mac OS X, il sera nécessaire de faire un clic droit sur l'icône Arduino IDE et sélectionner l'option "Show Package Contents" pour voir les fichiers.
# Open ServoTimers.h in a text editor.
+
# Ouvrir {{fname|ServoTimers.h}} dans un éditeur de texte.
# Locate the following lines of code in ServoTimers.h:
+
# Localiser les lignes suivante dans ServoTimers.h:
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
 
     #elif defined(__AVR_ATmega32U4__)   
 
     #elif defined(__AVR_ATmega32U4__)   
Ligne 16 : Ligne 16 :  
     typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
 
     typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t ;
 
</syntaxhighlight>
 
</syntaxhighlight>
# The lower two lines of code specify that the library should use Timer 1. To use Timer 3 instead, just change {{fname|_useTimer1}} to {{fname|_useTimer3}} and {{fname|_timer1}} to {{fname|_timer3}}.
+
# Les deux dernières lignes indiquent que la bibliothèque utilise le Timer 1. Pour utiliser le Timer 3 à la place, changer simplement {{fname|_useTimer1}} par  {{fname|_useTimer3}} et {{fname|_timer1}} par {{fname|_timer3}}.
# Save the file.
+
# Sauver le fichier.
 
  −
The Arduino IDE will automatically incorporate your modifications to the Servo library. The next time you compile a sketch for an ATmega32U4 based controller that uses the Servo library, it will use Timer 3 instead of Timer 1.
      +
Arduino IDE incorporera automatiquement les modification de la bibliothèque Servo. La prochaine fois que vous compilerez un croquis pour un microcontrôleur ATmega32U4, la bibliothèque servo utilisera le Timer 3 à la place du Timer 1.
    
{{Pololu-Romi-32U4-TRAILER}}
 
{{Pololu-Romi-32U4-TRAILER}}
29 917

modifications

Menu de navigation