Skip to main content
Commonmark migration
Source Link

I followed the project described in Raspberry Pi Shutdown Switch – Safely Turning off the Pi, but set pin 17 to be internally pulled up. Then connect the wires like the above project, but leave out any resistors and add the following Python script in /etc/rc.local:

python shutdown_button.py

###File shutdown_button.py

File shutdown_button.py

import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down = GPIO.PUD_UP)
while True:
    print GPIO.input(17)
    if (GPIO.input(17) == False):
        os.system("sudo shutdown -h now")
        break
    time.sleep(1)

I followed the project described in Raspberry Pi Shutdown Switch – Safely Turning off the Pi, but set pin 17 to be internally pulled up. Then connect the wires like the above project, but leave out any resistors and add the following Python script in /etc/rc.local:

python shutdown_button.py

###File shutdown_button.py

import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down = GPIO.PUD_UP)
while True:
    print GPIO.input(17)
    if (GPIO.input(17) == False):
        os.system("sudo shutdown -h now")
        break
    time.sleep(1)

I followed the project described in Raspberry Pi Shutdown Switch – Safely Turning off the Pi, but set pin 17 to be internally pulled up. Then connect the wires like the above project, but leave out any resistors and add the following Python script in /etc/rc.local:

python shutdown_button.py

File shutdown_button.py

import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down = GPIO.PUD_UP)
while True:
    print GPIO.input(17)
    if (GPIO.input(17) == False):
        os.system("sudo shutdown -h now")
        break
    time.sleep(1)
Dressed the naked link, etc. Copy edited. Applied some formatting.
Source Link

Raspberry Pi Shutdown Switch – Safely Turning off the Pi

http://www.3cc.org/blog/2013/01/raspberry-pi-shutdown-switch-safely-turning-off-the-pi/

I followed the project abovedescribed in Raspberry Pi Shutdown Switch – Safely Turning off the Pi, but set pin 17 to be internally pulled up. ThenThen connect the wires like the above project, but leave out any resistors and add the following pythonPython script in /etc/rc.local /etc/rc.local:

python shutdown_button.py

###File shutdown_button.py :

import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN,pull_up_down=GPIO pull_up_down = GPIO.PUD_UP)
while True:
    print GPIO.input(17)    
    if (GPIO.input(17) == False):
        os.system("sudo shutdown -h now")
        break
    time.sleep(1)

Raspberry Pi Shutdown Switch – Safely Turning off the Pi

http://www.3cc.org/blog/2013/01/raspberry-pi-shutdown-switch-safely-turning-off-the-pi/

I followed the project above but set pin 17 to be internally pulled up. Then connect the wires like the above project but leave out any resistors and add the following python script in /etc/rc.local python shutdown_button.py

shutdown_button.py :

import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN,pull_up_down=GPIO.PUD_UP)
while True:
    print GPIO.input(17)    
    if(GPIO.input(17) == False):
        os.system("sudo shutdown -h now")
        break
    time.sleep(1)

I followed the project described in Raspberry Pi Shutdown Switch – Safely Turning off the Pi, but set pin 17 to be internally pulled up. Then connect the wires like the above project, but leave out any resistors and add the following Python script in /etc/rc.local:

python shutdown_button.py

###File shutdown_button.py

import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down = GPIO.PUD_UP)
while True:
    print GPIO.input(17)
    if (GPIO.input(17) == False):
        os.system("sudo shutdown -h now")
        break
    time.sleep(1)
This project is can be complete more simply by removing the resistors and using an internal pullup resistor
Source Link

Raspberry Pi Shutdown Switch – Safely Turning off the Pi

http://www.3cc.org/blog/2013/01/raspberry-pi-shutdown-switch-safely-turning-off-the-pi/

I followed the project above but set pin 17 to be internally pulled up. Then connect the wires like the above project but leave out any resistors and add the following python script in /etc/rc.local python shutdown_button.py

shutdown_button.py :

import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN,pull_up_down=GPIO.PUD_UP)
while True:
    print GPIO.input(17)    
    if(GPIO.input(17) == False):
        os.system("sudo shutdown -h now")
        break
    time.sleep(1)

Raspberry Pi Shutdown Switch – Safely Turning off the Pi

http://www.3cc.org/blog/2013/01/raspberry-pi-shutdown-switch-safely-turning-off-the-pi/

Raspberry Pi Shutdown Switch – Safely Turning off the Pi

http://www.3cc.org/blog/2013/01/raspberry-pi-shutdown-switch-safely-turning-off-the-pi/

I followed the project above but set pin 17 to be internally pulled up. Then connect the wires like the above project but leave out any resistors and add the following python script in /etc/rc.local python shutdown_button.py

shutdown_button.py :

import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN,pull_up_down=GPIO.PUD_UP)
while True:
    print GPIO.input(17)    
    if(GPIO.input(17) == False):
        os.system("sudo shutdown -h now")
        break
    time.sleep(1)
Source Link
Loading