Código: Seleccionar todo
sudo apt-get install update
Nº 2.
Código: Seleccionar todo
sudo apt-get install python-dev
Nº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-pip
Código: Seleccionar todo
wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.11.tar.gz
Código: Seleccionar todo
sudo tar -zxvf RPi.GPIO-0.5.11.tar.gz
Código: Seleccionar todo
cd RPi.GPIO-0.5.11
Código: Seleccionar todo
sudo python setup.py install
Código: Seleccionar todo
sudo python3 setup.py install
Código: Seleccionar todo
mkdir /home/pi/scripts
Código: Seleccionar todo
sudo nano /home/pi/scripts/shutdown.py
Có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 reboot
Código: Seleccionar todo
sudo nano /etc/rc.local
Código: Seleccionar todo
sudo python /home/pi/scripts/shutdown.py &
Nº17. EJECUTA:
Código: Seleccionar todo
sudo reboot
