Différences entre versions de « RASP-SENSE-HAT-ASTRO-PI-Matrice »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
(Page créée avec « {{RASP-SENSE-HAT-ASTRO-PI-NAV}} {{traduction}} {{RASP-SENSE-HAT-ASTRO-PI-TRAILER}} »)
 
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}}

Version du 20 octobre 2015 à 19:42


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

La matrice LED

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

RASP-SENSE-HAT-ASTRO-PI-Matrice-00.png

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 sudo by typing:

sudo idle3 &

2. Type in the following code:

from sense_hat import SenseHat

sense = SenseHat()

r = 255
g = 255
b = 255

sense.clear((r, g, b))

3. Select File > Save (Fichier > Sauver) and choose a file name for your program.

4. Then select Run > Run module (Executer > Executer le module).

5. The LED matrix will then go bright white.

6. The variables r, g and 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:

from sense_hat import SenseHat

sense = SenseHat()

sense.show_message("Hello my name is Tim Peake", text_colour=(255, 0, 0))

Note the syntax {{{1}}} . Don't forget the comma!

2. You can also modify the background colour for the message like so:

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))

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.

RASP-SENSE-HAT-ASTRO-PI-Matrice-10.jpg



Source: Getting Started with Astro PI et Astro-Pi Guide proposé par Raspberry Pi Learning Resource (www.raspberrypi.org)

Licence Creative Commons - CC-BY-SA
The learning resource is provided for free by the Raspberry Pi Foundation under a Creative Commons licence.
Find more at raspberrypi.org/resources and github.com/raspberrypilearning.

Traduction réalisée par Meurisse. D pour shop.MCHobby.be - Licence CC-BY-SA.
Crédit de traduction: Toute référence, mention ou extrait de cette traduction doit également être explicitement accompagné du crédit de traduction suivant : «  Traduction par MCHobby (shop.MCHobby.be) » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.