Modifications

Sauter à la navigation Sauter à la recherche
331 octets ajoutés ,  7 février 2013 à 11:47
Ligne 47 : Ligne 47 :  
{{ traduction}}
 
{{ traduction}}
   −
Once you've adjusted the address on the backpack, you'll also want to adjust the address in the code!
+
Une fois que vous avez fixé l'adresse I2C du backpack, vous aurez également besoin de modifier l'adresse dans votre code!
For the Arduino library we wrote, its simple. For example, lets say you want to have two seven-segment matrices. One is set to address 0x70 and the other is set to 0x71. Find this code in the example
+
Pour la librairie écrite pour Arduino, c'est simple. Par exemple, considérons que vous voulez utiliser deux afficheurs 7 segments. L'un dispose de l'adresse 0x70 et l'autre de l'adresse 0x71.  
 +
 
 +
Vous trouverez ce code dans les exemples
    
  <nowiki>Adafruit_7segment matrix = Adafruit_7segment();
 
  <nowiki>Adafruit_7segment matrix = Adafruit_7segment();
Ligne 54 : Ligne 56 :  
     void setup() {
 
     void setup() {
 
     Serial.begin(9600);
 
     Serial.begin(9600);
     Serial.println("7 Segment Backpack Test");
+
     Serial.println("Test afficheur 7 Segment (Backpack)");
 
      
 
      
 
     matrix.begin(0x70);
 
     matrix.begin(0x70);
 
     }</nowiki>
 
     }</nowiki>
   −
And change it to this:
+
Que vous changerez pour obtenir:
    
  <nowiki>Adafruit_7segment matrix1 = Adafruit_7segment();
 
  <nowiki>Adafruit_7segment matrix1 = Adafruit_7segment();
Ligne 66 : Ligne 68 :  
void setup() {
 
void setup() {
 
Serial.begin(9600);
 
Serial.begin(9600);
Serial.println("Double 7 Segment Backpack Test");
+
Serial.println("Test d un double afficheur 7 Segments (Backpack)");
 
   
 
   
 
matrix1.begin(0x70);
 
matrix1.begin(0x70);
Ligne 72 : Ligne 74 :  
}</nowiki>
 
}</nowiki>
   −
That is, instantiate two matrix objects. Then one is called with '''begin(0x70)''' and the other is called with '''begin(0x71)'''. Each one can be used individually. If you need more matrices, just instantiate more objects at the top and '''begin()''' each one with the unique i2c address.
+
Voila! Le code modifié instancie deux objets de type "matrice 7 segments" (car un afficheur 7 segments est une matrice raccordée différemment).
 +
 
 +
Ensuite, un objet est appelé avec '''begin(0x70)''' et l'autre avec '''begin(0x71)'''.  
 +
 
 +
Ensuite, chaque instance (matrix1 ou matrix2) peut être utilisée individuellement. Si vous avez besoin de plus de matrice... instanciez simplement plus d'objets en haut du programme et initialiser le en appelant '''begin()''' (avec l'adresse I2C qui doit être unique sur le bus).
    
{{ADF-LED-BACKPACK-TRAILER}}
 
{{ADF-LED-BACKPACK-TRAILER}}
29 917

modifications

Menu de navigation