RASP-SENSE-HAT-ASTRO-PI-Débuter
Astro Pi is an add-on board for the Raspberry Pi, which adds the ability to sense all kinds of things and output information using a built-in 8x8 LED matrix. You can find out more about Astro Pi by following the Astro Pi Guide, which will show you how to connect and test your Astro Pi board. It also has some helpful explanations and examples of what the different inputs and outputs can do.
Once you are set up and have run your first program using the guide, you can begin to experiment further using this worksheet. In order to write your programs you will need to boot your Raspberry Pi to the desktop and start IDLE3, like you did in the guide.
sudo idle3 &
Afficher du Texte
When following the guide you will have written a sample program which scrolls text across the LED matrix. The program contains two crucial lines, which import the Astro Pi software and create an ap object which represents the Astro Pi board.
from astro_pi import AstroPi ap = AstroPi()
The third line is the one that makes the Astro Pi do something:
ap.show_message("Hello my name is Tim Peake")
You have probably already discovered that you can easily change the message to your own text, but there are more things that we can do.
1. We can expand the ap.show_message command to include some extra parameters which will change the behaviour of the message.
Parameter | Effect |
scroll_speed | The scroll_speed parameter affects how quickly the text moves on the screen. The default value is 0.1. The bigger the number, the slower the speed |
text_colour | The text_colour parameter alters the colour of the text and is specified using 3 values for Red, Green, Blue. Each value can be between 0 - 255, so [255,0,255] would be Red + Blue = Purple |
back_colour | The back_colour parameter alters the colour of the background and works in the same way as the text_colour |
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.
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é.