Différences entre versions de « ADF-LED-BACKPACK-7-Segments »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
Ligne 18 : Ligne 18 :
  
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-01.jpg}}
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-01.jpg}}
{{asm-text}} When you buy a pack from Adafruit, it comes with the fully tested and assembled backpack as well as a 7-segment display in one of the colors we provide (say, red, yellow, blue or green). You'll need to solder the matrix onto the backpack but its an easy task.
+
{{asm-text}} Lorsque vous achetez ce Backpack AdaFruit, il est livré complètement assemblé et testé avec un afficheur 7 segments dans l'une des couleurs disponible (selon votre choix entre rouge, jaune, bleu, vert). Vous aurez besoin de souder la matrice (afficheur) sur le backpack mais rassurez-vous, c'est une tâche assez simple.
  
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-02.jpg}}
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-02.jpg}}
{{asm-text}} Remove the parts from packaging and place the LED matrix OVER the silkscreen side. '''DO NOT PUT THE DISPLAY ON UPSIDE DOWN OR IT WONT WORK!! Check the image below to make sure the 'decimal point' dots are on the bottom, matching the silkscreen'''.
+
{{asm-text}} Retirez les éléments de leur emballage et placez la matrice LED (afficheur) AU DESSUS de la sérigraphie (partie avec les écritures). '''NE PLACEZ PAS L'AFFICHEUR A L'ENVERS SINON IL NE FONCTIONNERA PAS!! Vérifier sur l'image et assurez vous que les 'points de décimal' sont vers le bas et correspondent à ceux indiqués sur a sérigraphie'''.
  
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-03.jpg}}
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-03.jpg}}
{{asm-text}} Turn the backpack over so its sitting flat on the matrix.
+
{{asm-text}} Retourner le tour de façon à ce que le Backpack soit bien à plas sur la matrice/afficheur.
  
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-04.jpg}}
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-04.jpg}}
{{asm-text}} Solder all 14 pins.
+
{{asm-text}} Soudez les 14 broches.
  
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-06.jpg}}
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-06.jpg}}
 
{{asm-img|img=ADF-LED-BACKPACK-7SEG-05.jpg}}
 
{{asm-img|img=ADF-LED-BACKPACK-7SEG-05.jpg}}
{{asm-text}} Clip the long pins.
+
{{asm-text}} Raccourcissez les longues broches/pins.
  
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-08.jpg}}
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-08.jpg}}
{{asm-text}} Now you're ready to wire it up to a microcontroller. We'll assume you want to use a 4pin header. You can also of course solder wires directly. Place a 4-pin piece of header with the LONG pins down into the breadboard.
+
{{asm-text}} Vous êtes maintenant prêt à le raccorder sur un microcontroleur. Partons du principe que vous voulez utiliser un pinHeader de 4 broches (vous pouvez, bien entendu, souder les fils directement sur l'afficheur). Placez une section de 4 broches avec la partie longue insérée dans le Breadboard.
  
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-09.jpg}}
 
{{asm-row|img=ADF-LED-BACKPACK-7SEG-09.jpg}}
{{asm-text}} Place the soldered backpack on top of the header and Solder 'em!
+
{{asm-text}} Placez le Backpack sur le connecteur (les broches courtes doivent passer par les trous) et soudez les!
  
 
{{asm-end}}
 
{{asm-end}}
  
That's it! now you're ready to run the firmware!
+
Voila, vous êtes maintenant prêt à utiliser le firmware!
  
'''Seven-Segment Backpack Firmware'''
+
'''Programmation du Backpack 7-Segment'''
  
'''We wrote a basic library to help you work with the 7-segment backpack. The library is written for the Arduino and will work with any Arduino as it just uses the I2C pins. The code is very portable and can be easily adapted to any I2C-capable micro.''''
+
'''AdaFruit à écrit une librairie pour vous aider à utiliser le backpack 7-segments. La librairie est écrite pour Arduino et fonctionnera avec n'importe quel Arduino puisqu'il n'utilise que le bus I2C. C'est un code portable qui devrait être facilement adapté pour d'autres micro-controleurs.''''
  
Wiring to the matrix is really easy
+
Raccorder l'afficheur est vraiment simple
  
* Connect '''CLK''' to the I2C clock - on Arduino UNO thats Analog #5, on the Leonardo its Digital #3, on the Mega its digital #21
+
* Connectez '''CLK''' sur le signal d'horloge I2C - Sur un Arduino UNO c'est la broche Analogique #5, Sur Leonardo c'est la broche Digital #3, sur le Mega c'est la broche Digital #21
* Connect '''DAT''' to the I2C data - on Arduino UNO thats Analog #4, on the Leonardo its Digital #2, on the Mega its digital #20
+
* Connectez '''DAT''' sur la connexion Data d'I2C - Sur un Arduino UNO c'est la broche Analogique #4, Sur Leonardo c'est la broche Digital #2, sur le Mega c'est la broche Digital #20
* Connect '''GND''' to common ground
+
* Connectez '''GND''' à la masse commune (Gnd/Ground)
* Connect '''VCC+''' to power - 5V is best but 3V also seems to work for 3V microcontrollers.
+
* Connectez '''VCC+''' pour l'alimentation - 5V est préférable mais cela semble fonctionner en 3V (pour les microcontroleurs 3V).
  
Next, download the [https://github.com/adafruit/Adafruit-LED-Backpack-Library Adafruit LED Backpack library from github] . To download click the DOWNLOADS button in the top right corner, rename the uncompressed folder '''Adafruit_LEDBackpack'''. Check that the '''Adafruit_LEDBackpack''' folder contains '''Adafruit_LEDBackpack.cpp''' and '''Adafruit_LEDBackpack.h''' Place the Adafruit_LEDBackpack library folder your ''arduinosketchfolder/'''libraries'''/'' folder. You may need to create the libraries subfolder if its your first library. [https://github.com/adafruit/Adafruit-GFX-Library You'll also need to download the Adafruit GFX library - rename it and install it as the LED backpack library. Its not actually used for the 7-segment, its only for the matrix backpacks but its still required. Restart the IDE.
+
Ensuite, téléchargez la [https://github.com/adafruit/Adafruit-LED-Backpack-Library libriarie Adafruit LED Backpack depui github] . Pour télécharger, cliquez sur le bouton DOWNLOADS dans le coin supérieur droit, renommez le répertoire décompressé comme '''Adafruit_LEDBackpack'''.  
 +
 
 +
Vérifiez que le répertoire '''Adafruit_LEDBackpack''' contiennent bien les fichiers '''Adafruit_LEDBackpack.cpp''' et '''Adafruit_LEDBackpack.h'''. Placez le répertoire de la librairie Adafruit_LEDBackpack dans votre répertoire Arduino ''arduinosketchfolder/'''libraries'''/''.  
 +
 
 +
Vous pourez avoir besoin de créer un sous répertoire "libraries" s'il s'agit de votre première librairie.
 +
 
 +
[https://github.com/adafruit/Adafruit-GFX-Library Vous aurez également besoin de télécharher la librairie Adafruit GFX - que vous renommerez et installerez également dans les librairies Arduino]. Cette librairie n'est pas utilisée par l'afficheur 7-segments mais uniquement pour les affichages en matrice. Sont installation est cependant nécessaire.
 +
 
 +
Redémarrez votre Arduino IDE.
 +
 
 +
{{traduction}}
  
 
Once you've restarted you should be able to select the '''File > Examples > Adafruit_LEDBackpack > sevenseg''' example sketch. Upload it to your Arduino as usual. You should see a basic test program that goes through a bunch of different routines.
 
Once you've restarted you should be able to select the '''File > Examples > Adafruit_LEDBackpack > sevenseg''' example sketch. Upload it to your Arduino as usual. You should see a basic test program that goes through a bunch of different routines.

Version du 4 février 2013 à 12:12

Cette version du backpack LED est conçue pour pour pilote de grands afficheurs 7-segments (super-brillant). Ces afficheurs réclame normalement 13 broches/pins pour être pilotés correctement (5 'caractères' avec un total de 8 segments chacun). Ce backpack résout l'épineux problème d'utiliser 13 broches de votre microcontroleur et/ou une tonne de composants pour alimenter les segments de la matrice/afficheur en courant constant... le tout via une interface I2C.

Le contrôleur placé à l'arrière du backpack prend tout cela en charge, et pilote toutes les LEDs en tâche de fond. Tout ce que vous avez à faire est d'écrire les données en utilisant une interface I2C à 2 broches/pins.

Il y a également 3 cavaliers de sélection d'adresse. Vous pouvez donc sélectionner jusqu'à une des 8 adresses pour contrôler jusqu'à 8 afficheurs sur un somple bus I2C 2-broches/pins (tout comme n'importe quel autre composant ou senseur I2C de votre choix).

Le composant pilotant la matrice peut ajuster la brillance de l'afficheur entier depuis 1/16 à pleine luminosité (par incrément de 1/16). Il ne peut pas la brillance d'une LED individuelle, seule la brillance de l'afficheur entier peut être altéré.

ADF-LED-BACKPACK-7SEG-10.jpg

ADF-LED-BACKPACK-7SEG-01.jpg Lorsque vous achetez ce Backpack AdaFruit, il est livré complètement assemblé et testé avec un afficheur 7 segments dans l'une des couleurs disponible (selon votre choix entre rouge, jaune, bleu, vert). Vous aurez besoin de souder la matrice (afficheur) sur le backpack mais rassurez-vous, c'est une tâche assez simple.
ADF-LED-BACKPACK-7SEG-02.jpg Retirez les éléments de leur emballage et placez la matrice LED (afficheur) AU DESSUS de la sérigraphie (partie avec les écritures). NE PLACEZ PAS L'AFFICHEUR A L'ENVERS SINON IL NE FONCTIONNERA PAS!! Vérifier sur l'image et assurez vous que les 'points de décimal' sont vers le bas et correspondent à ceux indiqués sur a sérigraphie.
ADF-LED-BACKPACK-7SEG-03.jpg Retourner le tour de façon à ce que le Backpack soit bien à plas sur la matrice/afficheur.
ADF-LED-BACKPACK-7SEG-04.jpg Soudez les 14 broches.
ADF-LED-BACKPACK-7SEG-06.jpg


ADF-LED-BACKPACK-7SEG-05.jpg

Raccourcissez les longues broches/pins.
ADF-LED-BACKPACK-7SEG-08.jpg Vous êtes maintenant prêt à le raccorder sur un microcontroleur. Partons du principe que vous voulez utiliser un pinHeader de 4 broches (vous pouvez, bien entendu, souder les fils directement sur l'afficheur). Placez une section de 4 broches avec la partie longue insérée dans le Breadboard.
ADF-LED-BACKPACK-7SEG-09.jpg Placez le Backpack sur le connecteur (les broches courtes doivent passer par les trous) et soudez les!

Voila, vous êtes maintenant prêt à utiliser le firmware!

Programmation du Backpack 7-Segment

AdaFruit à écrit une librairie pour vous aider à utiliser le backpack 7-segments. La librairie est écrite pour Arduino et fonctionnera avec n'importe quel Arduino puisqu'il n'utilise que le bus I2C. C'est un code portable qui devrait être facilement adapté pour d'autres micro-controleurs.'

Raccorder l'afficheur est vraiment simple

  • Connectez CLK sur le signal d'horloge I2C - Sur un Arduino UNO c'est la broche Analogique #5, Sur Leonardo c'est la broche Digital #3, sur le Mega c'est la broche Digital #21
  • Connectez DAT sur la connexion Data d'I2C - Sur un Arduino UNO c'est la broche Analogique #4, Sur Leonardo c'est la broche Digital #2, sur le Mega c'est la broche Digital #20
  • Connectez GND à la masse commune (Gnd/Ground)
  • Connectez VCC+ pour l'alimentation - 5V est préférable mais cela semble fonctionner en 3V (pour les microcontroleurs 3V).

Ensuite, téléchargez la libriarie Adafruit LED Backpack depui github . Pour télécharger, cliquez sur le bouton DOWNLOADS dans le coin supérieur droit, renommez le répertoire décompressé comme Adafruit_LEDBackpack.

Vérifiez que le répertoire Adafruit_LEDBackpack contiennent bien les fichiers Adafruit_LEDBackpack.cpp et Adafruit_LEDBackpack.h. Placez le répertoire de la librairie Adafruit_LEDBackpack dans votre répertoire Arduino arduinosketchfolder/libraries/.

Vous pourez avoir besoin de créer un sous répertoire "libraries" s'il s'agit de votre première librairie.

Vous aurez également besoin de télécharher la librairie Adafruit GFX - que vous renommerez et installerez également dans les librairies Arduino. Cette librairie n'est pas utilisée par l'afficheur 7-segments mais uniquement pour les affichages en matrice. Sont installation est cependant nécessaire.

Redémarrez votre Arduino IDE.

Once you've restarted you should be able to select the File > Examples > Adafruit_LEDBackpack > sevenseg example sketch. Upload it to your Arduino as usual. You should see a basic test program that goes through a bunch of different routines.

ADF-LED-BACKPACK-7SEG-10.jpg

Once you're happy that the matrix works, you can write your own sketches.

There's a few ways you can draw to the display. The easiest is to just call print - just like you do with Serial

  • print(variable,HEX) - this will print a hexidecimal number, from 0000 up to FFFF
  • print(variable,DEC) or print(variable) - this will print a decimal integer, from 0000 up to 9999

If you need more control, you can call writeDigitNum(location, number) - this will write the number (0-9) to a single location. Location #0 is all the way to the left, location #2 is the colon dots so you probably want to skip it, location #4 is all the way to the right. If you want a decimal point, call writeDigitNum(location, number, true) which will paint the decimal point. To draw the colon, use drawColon(true or false)

If you wnat even more control, you can call writeDigitRaw(location,bitmask) to draw a raw 8-bit mask (as stored in a uint8_t) to that location.

All the drawing routines only change the display memory kept by the Arduino. Don't forget to call writeDisplay() after drawing to 'save' the memory out to the matrix via I2C.

There are also a few small routines that are special to the backpack:

  • setBrightness(brighness)- will let you change the overall brightness of the entire display. 0 is least bright, 15 is brightest and is what is initialized by the display when you start
  • blinkRate(rate) - You can blink the entire display. 0 is no blinking. 1, 2 or 3 is for display blinking.

Source: Control small led matrice with ease créé par LadyAda pour AdaFruit Industries. Crédit AdaFruit Industries

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.