Modifications

Sauter à la navigation Sauter à la recherche
Ligne 1 : Ligne 1 :  
{{Rasp-Hack-Led-Backpack-NAV}}
 
{{Rasp-Hack-Led-Backpack-NAV}}
  −
{{traduction}}
      
== Utiliser la librairie AdaFruit ==
 
== Utiliser la librairie AdaFruit ==
   −
The Python code to work with Adafruit's LED Backpacks on the Pi is available on Github at https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code
+
{{bloc-etroit
 +
  | text = Le code Python fait fonctionner les Backpack LEDs sur le Pi est disponible sur le Gitub d'AdaFruit à https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code
   −
This code should be a good starting point to understanding how you can access SMBus/I2C devices with your Pi, and getting your blinky on.
+
Ce code devrait être un bon point de départ pour comprendre comment accéder au périphérique d'un bus SMBus/I2C depuis votre Pi.
   −
If you're running Wheezy or something-other-than-Occidentalis, you will need to set up I2C first.
+
Si vous utilisez Wheezy ou un dérivé comme Occidentalis, vous aurez d'abord besoin d'activer I2C.
   −
[[Rasp-Hack-GPIO Configurer I2C|Follow this tutorial to fully enable i2c]]
+
[[Rasp-Hack-GPIO Configurer I2C|Vous pouvez suivre les étapes de ce tutoriel pour activer I2C]]
 +
}}
   −
== Downloading the Code from Github ==
+
== Installer les logiciels nécessaires ==
The easiest way to get the code onto your Pi is to hook up an Ethernet cable, and clone it directly using 'git', which is installed by default on most distros. Simply run the following commands from an appropriate location (ex. "/home/pi"):  
+
Pour installer et utiliser la bibliothèque Adafruit, nous aurons besoin des logiciels suivants:
 +
 
 +
<nowiki>sudo apt-get update
 +
sudo apt-get install -y git build-essential python-dev python-smbus python-imaging python-pip python-pil</nowiki>
 +
 
 +
== Télécharger le code depuis Github ==
 +
{{bloc-etroit
 +
  | text = La façon la plus simple de placer le code sur votre Pi est encore de raccorder un cable Ethernet, et de le cloner directement en utilisant 'git'. Git est installé par défaut sur la plupart des distributions. Exécutez simplement les commande suivantes depuis un répertoire approprié (ex: "/home/pi"):  
 +
}}
   −
  <nowiki>   sudo apt-get install git
+
  <nowiki>git clone https://github.com/adafruit/Adafruit_Python_LED_Backpack.git
    git clone https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git
+
cd Adafruit_Python_LED_Backpack
    cd Adafruit-Raspberry-Pi-Python-Code
+
sudo python setup.py install</nowiki>
    cd Adafruit_LEDBackpack</nowiki>
      
== Tester la librairie ==
 
== Tester la librairie ==
Once the code has be downloaded to an appropriate folder, and you have your LED Backpack board properly connected, you can test it out with the following commands (the driver includes a few simple demo programs)
+
Une fois que la librairie est téléchargé dans un répertoire approprié, et que le backpack LED (contrôleur LED) est raccordé correctement, vous pouvez tester le tout avec les commandes suivantes (les pilotes Python inclus quelques programmes de démonstration)
   −
If you're using a rev 2 (512Mb RAM model B) Pi you will have to edit Adafruit_LEDBackpack.py using nano '''Adafruit_LEDBackpack.py''' and change the i2c bus over from port #0 to port #1 as it was updated in the second rev to a different number:
+
Si vous utilisez un Raspberry rev 2 (512Mb RAM modèle B) vous devrez modifier le fichier Adafruit_LEDBackpack.py en utilisant '''nano Adafruit_LEDBackpack.py''' et en changeant le bus I2C depuis le PORT #0 vers le PORT #1 (puisque cette broche à été déplacée dans la seconde révision du Pi):
    
  <nowiki>self.i2c = Adafruit_I2C(address, bus=smbus.SMBus(0))</nowiki>
 
  <nowiki>self.i2c = Adafruit_I2C(address, bus=smbus.SMBus(0))</nowiki>
   −
to
+
en
    
  <nowiki>self.i2c = Adafruit_I2C(address, bus=smbus.SMBus(1))</nowiki>
 
  <nowiki>self.i2c = Adafruit_I2C(address, bus=smbus.SMBus(1))</nowiki>
   −
For '''8x8 displays''', you can run a simple test with:  
+
Pour une '''matrice 8x8''', vous pouvez exécuter le programme de test avec:  
   −
   <nowiki>sudo python ex_8x8_pixels.py</nowiki>
+
   <nowiki>cd examples
 +
sudo python matrix8x8_test.py</nowiki>
   −
Which should result in something like the following:
+
ce qui devrait produire le résultat suivant:
    
{{#Widget:Iframe
 
{{#Widget:Iframe
|url=http://www.youtube.com/embed/AYArwe-OkdQ
+
|url=https://www.youtube.com/embed/AYArwe-OkdQ
 
|width=420
 
|width=420
 
|height=315
 
|height=315
Ligne 45 : Ligne 53 :  
}}
 
}}
   −
For '''4-character, 7-segment displays''', you can run a clock demo with:
+
Pour les '''afficheurs 4-charactères, 7-segments''', vous pouvez exécuter la démonstration du programme d'horloge avec:
   −
  <nowiki>sudo python ex_7segment_clock.py</nowiki>
+
  <nowiki>sudo python sevensegment_test.py</nowiki>
   −
Which should result in the following:
+
Ce qui devrait produire le résultat suivant:
    
{{#Widget:Iframe
 
{{#Widget:Iframe
|url=http://www.youtube.com/embed/AAgTe27reIk
+
|url=https://www.youtube.com/embed/AAgTe27reIk
 
|width=420
 
|width=420
 
|height=315
 
|height=315
29 836

modifications

Menu de navigation