Modifications

Sauter à la navigation Sauter à la recherche
Ligne 133 : Ligne 133 :     
== Afficher des images ==
 
== Afficher des images ==
The LED matrix can display more than just text! We can control each LED individually to create an image. We can accomplish this in a couple of ways.
+
La matrice LED peut afficher plus que du texte! Nous pouvons contrôler chacune des LEDs individuellement pour créer des images. Il y a plusieurs façon d'accomplir cette prouesse.
   −
'''1.''' The first approach is to set pixels (LEDs) individually; we can do this using the {{fname|ap.set_pixel()}} method. First, we need to be clear about how we describe each pixel.
+
'''1.''' La première approche est d'activer les points (dit "pixel" en anglais) individuellement. En activant un point, nous allumons une LED bien précise; nous pouvons réaliser cette opération à l'aide de la méthode {{fname|ap.set_pixel()}}. Pour commencer, nous devons clarifier comment nous pouvons identifier clairement chaque point (''pixel'').
   −
The Astro Pi board uses a coordinate system like the one shown below; crucially the numbering begins at '''0''', not 1. Also, the origin is in the '''top left''' rather than the bottom left as you may be used to.
+
La carte Astro Pi utilise un système de coordonée tels que celui présenté ci-dessous; point cruciaux:
 +
* La numérotation débute à '''0''' et non à 1.  
 +
* L'origine se trouve dans le point '''en haut à gauche''' plutôt que en bas à gauche comme vous pourriez en avoir l'habitude.
    
[[Fichier:RASP-SENSE-HAT-ASTRO-PI-Debuter-20.png]]
 
[[Fichier:RASP-SENSE-HAT-ASTRO-PI-Debuter-20.png]]
   −
* the blue pixel is at coordinates (0, 2)
+
* Le point (''pixel'') bleu se trouve à la coordonnée (0, 2)
* the red pixel is at coordinates (7, 4)
+
* Le point (''pixel'') rouge se trouve à la coordonnée (7, 4)
   −
To replicate the above diagram you would enter a program like this:
+
Pour répliquer le diagramme ci-dessous dans un programme, nous le ferions comme ceci:
    
  <nowiki>from astro_pi import AstroPi
 
  <nowiki>from astro_pi import AstroPi
29 917

modifications

Menu de navigation