@@ -0,0 +1,692 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0Aimport os, sys%0Aif not os.getuid() == 0:%0A    sys.exit('Needs to be root for running this script.')%0Aimport RPi.GPIO as GPIO%0Aimport time%0A# the stop signal%0ABTN_IO = 12%0A# we use the board numbering of the I/O%0A# ie the RasPi header pin numbering%0AGPIO.setmode(GPIO.BOARD)%0A# the I/O is configured as input with pullup enabled%0AGPIO.setup(BTN_IO, GPIO.IN, GPIO.PUD_DOWN)%0AGPIO.setup(16, GPIO.OUT)%0AGPIO.output(16, GPIO.HIGH)%0Adef stopFunction(channel):%0A  os.system(%22sudo halt%22)%0AGPIO.add_event_detect(BTN_IO, GPIO.RISING, callback = stopFunction, bouncetime = 300)%0Atry:%0A  while True:%0A    time.sleep(1)%0Aexcept KeyboardInterrupt:%0A  GPIO.cleanup()%0AGPIO.cleanup()%0A

Add a file to deal with power supply