Hallo an Alle,
Habe zum Ausschalten des Rpi folgendes Skript benutzt:The Python Way
# Simple script for shutting down the raspberry Pi at the press of a button.# by Inderpreet Singh import RPi.GPIO as GPIOimport timeimport os # Use the Broadcom SOC Pin numbers# Setup the Pin with Internal pullups enabled and PIN in reading mode.GPIO.setmode(GPIO.BCM)GPIO.setup(31, GPIO.IN, pull_up_down = GPIO.PUD_UP) # Our function on what to do when the button is presseddef Shutdown(channel): os.system("sudo shutdown -h now") # Add our function to execute when the button pressed event happensGPIO.add_event_detect(31, GPIO.FALLING, callback = Shutdown, bouncetime = 2000) # Now wait!while 1: time.sleep(1)
Copy the script code and create a file using nano and save it in a known location as shutdown.py. I created a folder in my home folder called scripts and saved them there. In order to test the script run the following command
1 sudo python /home/pi/scripts/shutdown.py
Das klappt an sich super, nur habe ich folgendes Problem:
Beim Start wird auch direkt Libreoffice mit einer PPS geöffnet, die in Schleife läuft.
Drücke ich jetzt den Taster, fährt der Rechner zwar herunter, es wird aber jedes Mal die PPS zerstört und beim nächsten Start muß immer eine Reparatur der Datei gestartet werden, bevor die Präsentation anläuft.
Was kann ich machen, damit beim Tastendruck erst die Präsentation beendet wird, und dann erst der Rechner herunterfährt?
Vielen Dank vorab für die Mühe!