Raspberry:Astuces : Différence entre versions
(→Rotation de l'écran) |
|||
| Ligne 33 : | Ligne 33 : | ||
Sources'' | Sources'' | ||
* http://raspberrypi.stackexchange.com/questions/4123/running-a-python-script-at-startup | * http://raspberrypi.stackexchange.com/questions/4123/running-a-python-script-at-startup | ||
| + | |||
| + | == Exemple d'action au démarrage == | ||
| + | <syntaxhighlight lang=bash> | ||
| + | #!/bin/bash | ||
| + | |||
| + | #VNC | ||
| + | x11vnc -forever -display :0 > /dev/null 2>&1 & | ||
| + | |||
| + | sleep 5 | ||
| + | |||
| + | #Lecture video | ||
| + | #omxplayer --loop Tomorrowland_2012_official_aftermovie.mp4 | ||
| + | |||
| + | #Lecture video sur ecran raspberry 7 | ||
| + | #omxplayer --win "0 0 840 480 " --loop Tomorrowland_2012_official_aftermovie.mp4 | ||
| + | |||
| + | #Script refresh | ||
| + | #sudo python /home/pi/button-refresh.py & | ||
| + | |||
| + | #Navigateur Web | ||
| + | #iceweasel http://192.168.100.7/Piano/piano/index.html | ||
| + | |||
| + | </syntaxhighlight> | ||
== Rotation de l'écran == | == Rotation de l'écran == | ||
Version du 26 novembre 2015 à 14:17
Sommaire
Script au démarrage
Pour lancer un script au démarrage du Raspberry, il faut l'ajouter au fichier .config/lxsession/LXDE-pi/autostart
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@sh ${HOME}/.config/lxsession/LXDE-pi/autokey.sh
@xset s noblank
@xset s off
@xset -dpms
@/home/pi/script-at-boot.sh
Script python au démarrage
Pour lancer un script python au démarrage, j'ai trouvé l'astuce suivante :
On crée un fichier .desktop dans le dossier /home/pi/.config/autostart/ qui portera le nom de l'application. Dans mon cas, ca sera button-refresh.py . Voici le contenu :
[Desktop Entry] Encoding=UTF-8 Type=Application Name=button-refresh Comment= Exec= sudo python /home/pi/button-refresh.py StartupNotify=false Terminal=true Hidden=false
Sources
Exemple d'action au démarrage
#!/bin/bash
#VNC
x11vnc -forever -display :0 > /dev/null 2>&1 &
sleep 5
#Lecture video
#omxplayer --loop Tomorrowland_2012_official_aftermovie.mp4
#Lecture video sur ecran raspberry 7
#omxplayer --win "0 0 840 480 " --loop Tomorrowland_2012_official_aftermovie.mp4
#Script refresh
#sudo python /home/pi/button-refresh.py &
#Navigateur Web
#iceweasel http://192.168.100.7/Piano/piano/index.htmlRotation de l'écran
Pour changer l'orientation de l'affichage, il faut ajouter au fichier /boot/config.txt la ligne suivante :
display_rotate=x
Où x peut prendre les valeurs suivantes :
| Valeur | Orientation |
|---|---|
| 0 | Normal |
| 1 | 90° |
| 2 | 180° |
| 3 | 270° |
| 0x10000 | Horizontal Flip |
| 0x20000 | Vertical Flip |
Sources