Código: Seleccionar todo
sudo apt-get install updateNº 2.
Código: Seleccionar todo
sudo apt-get install python-devNº3.
Código: Seleccionar todo
sudo apt-get install python3-dev Nº4.
Código: Seleccionar todo
sudo apt-get install gcc Nº 5.
Código: Seleccionar todo
sudo apt-get install python-pipCódigo: Seleccionar todo
wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.11.tar.gzCódigo: Seleccionar todo
sudo tar -zxvf RPi.GPIO-0.5.11.tar.gzCódigo: Seleccionar todo
cd RPi.GPIO-0.5.11Código: Seleccionar todo
sudo python setup.py installCódigo: Seleccionar todo
sudo python3 setup.py installCódigo: Seleccionar todo
mkdir /home/pi/scriptsCódigo: Seleccionar todo
sudo nano /home/pi/scripts/shutdown.pyCódigo: Seleccionar todo
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import subprocess
# we will use the pin numbering to match the pins on the Pi, instead of the
# GPIO pin outs (makes it easier to keep track of things)
GPIO.setmode(GPIO.BOARD)
# use the same pin that is used for the reset button (one button to rule them all!)
GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP)
oldButtonState1 = True
while True:
#grab the current button state
buttonState1 = GPIO.input(5)
# check to see if button has been pushed
if buttonState1 != oldButtonState1 and buttonState1 == False:
subprocess.call("shutdown -h now", shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
oldButtonState1 = buttonState1
time.sleep(.1)Nº13. Resetear raspberry
Código: Seleccionar todo
sudo rebootCódigo: Seleccionar todo
sudo nano /etc/rc.localCódigo: Seleccionar todo
sudo python /home/pi/scripts/shutdown.py &Nº17. EJECUTA:
Código: Seleccionar todo
sudo reboot




