Modifications

Sauter à la navigation Sauter à la recherche
3 204 octets ajoutés ,  20 octobre 2015 à 19:42
aucun résumé de modification
Ligne 2 : Ligne 2 :     
{{traduction}}
 
{{traduction}}
 +
 +
== La matrice LED ==
 +
{{bloc-etroit|text=The Sense HAT LED matrix contains 64 multi-colour LEDs. Each of the 64 LEDs actually have three smaller LEDs inside them, one for each primary colour, just like a pixel on a TV, monitor or smartphone screen.}}
 +
 +
== Mélange des couleurs ==
 +
[[Fichier:RASP-SENSE-HAT-ASTRO-PI-Matrice-00.png]]
 +
 +
{{bloc-etroit|text=In additive colour mixing there are three primary colours: red, green, and blue. In the image above, there are three spotlights of equal brightness, one for each primary colour. In the absence of any colour the result is black. If all three primary colours are mixed, the result is white. When red and green combine, the result is yellow. When red and blue combine, the result is magenta. When blue and green combine, the result is cyan. It's possible to make even more colours than this by varying the brightness of the primary colours used.}}
 +
 +
'''1.''' Open '''Python 3''' from a terminal window as {{fname|sudo}} by typing:
 +
 +
<nowiki>sudo idle3 &</nowiki>
 +
 +
'''2.''' Type in the following code:
 +
 +
<nowiki>from sense_hat import SenseHat
 +
 +
sense = SenseHat()
 +
 +
r = 255
 +
g = 255
 +
b = 255
 +
 +
sense.clear((r, g, b))</nowiki>
 +
 +
'''3.''' Select {{fname|File > Save}} (''Fichier > Sauver'') and choose a file name for your program.
 +
 +
'''4.''' Then select {{fname|Run > Run module}} (''Executer > Executer le module'').
 +
 +
'''5.''' The LED matrix will then go bright white.
 +
 +
'''6.''' The variables {{fname|r}}, {{fname|g}} and {{fname|b}} represent the primary colours red, green, and blue. The numbers they contain specify how bright each colour should be; they can be between 0 and 255. In the above code the maximum value for each colour has been used, so the result is white.
 +
 +
'''7.''' Change the values to specify 255 red but 0 green and blue, then run the code again.
 +
 +
'''8.''' Quels autres couleurs pouvez vous créer.
 +
 +
== Modifier la couleur d'avant plan et d'arrière plan ==
 +
This colour mixing system is used throughout the Astro Pi programming module. You can use colour mixing to great effect by programming scrolling text. In this example, you can set the colour of the text that will appear on the matrix.
 +
 +
'''1.''' Type the following code into a new file:
 +
 +
<nowiki>from sense_hat import SenseHat
 +
 +
sense = SenseHat()
 +
 +
sense.show_message("Hello my name is Tim Peake", text_colour=(255, 0, 0))</nowiki>
 +
 +
Note the syntax {{fname|, text_colour=(255, 0, 0)}} . Don't forget the comma!
 +
 +
'''2.''' You can also modify the background colour for the message like so:
 +
 +
<nowiki>from sense_hat import SenseHat
 +
 +
sense = SenseHat()
 +
 +
sense.show_message("Hello my name is Tim Peake", text_colour=(255, 255, 0), back_colour=(0, 0, 255))</nowiki>
 +
 +
Note: The comma is important, don't forget it!
 +
 +
== Les Pixels ==
 +
Les 'Pixels' sont des points. Le terme est très répandu dans le monde informatique où le Pixel représente toujours ''un point dans l'interface graphique''. Il est donc très fréquent de rencontrer le terme 'Pixel', même dans la littérature francophone.
 +
 +
This image shows the pixels on a laptop LCD screen. You can see that the pixels are turned on and off to form the pattern of letters and numbers.
 +
 +
[[Fichier:RASP-SENSE-HAT-ASTRO-PI-Matrice-10.jpg]]
 +
    
{{RASP-SENSE-HAT-ASTRO-PI-TRAILER}}
 
{{RASP-SENSE-HAT-ASTRO-PI-TRAILER}}
29 917

modifications

Menu de navigation