Modifications

Sauter à la navigation Sauter à la recherche
1 025 octets ajoutés ,  20 octobre 2015 à 20:03
Ligne 161 : Ligne 161 :  
Instead of setting the LED matrix, you may wish to use images which are loaded from files. This is a convenient option if you want to have lots of stock images, for example international flags.
 
Instead of setting the LED matrix, you may wish to use images which are loaded from files. This is a convenient option if you want to have lots of stock images, for example international flags.
    +
'''1.''' Use any graphics editing tool (on Windows, OS X or Linux) to create the files. As long as they are saved onto the Raspberry Pi's SD card as {{fname|JPEG}} or {{fname|PNG}}, and are 8 x 8 pixels in size, then they can be loaded directly to the LED matrix with a single command.
    +
'''2.''' Open the ''File Manager'' (Gestionnaire de fichier) on the Raspberry Pi using Menu > Accessoires > Gestionnaire de fichier.
 +
 +
'''3.''' Browse into the {{fname|astro-pi-hat}} folder followed by {{fname|examples}}. There should be a file named {{fname|space_invader.png}} which you can double-click.
 +
 +
'''4.''' Load the image onto the Sense Hat LED matrix by using the {{fname|load_image}} function, which needs the file system path to the file you want to load. So for {{fname|space_invader.png}} the full path is {{fname|/home/pi/astro-pi-hat/examples/space_invader.png}}.
 +
 +
Here is the code:
 +
 +
<nowiki>from sense_hat import SenseHat
 +
 +
sense = SenseHat()
 +
 +
sense.load_image("/home/pi/astro-pi-hat/examples/space_invader.png")</nowiki>
    
{{RASP-SENSE-HAT-ASTRO-PI-TRAILER}}
 
{{RASP-SENSE-HAT-ASTRO-PI-TRAILER}}
29 917

modifications

Menu de navigation