I have two scripts in my rc.local file that are virtually identical (but pin numbers different etc). Only one is loading on startup though.
Here is the one that DOES load:
Code: Select all
# Import the modules to send commands to the system and access GPIO pins
from subprocess import call
import RPi.GPIO as gpio
# Define a function to keep script running
def loop():
raw_input()
# Define a function to run when an interrupt is called
def shutdown(pin):
call('halt', shell=False)
gpio.setmode(gpio.BOARD) # Set pin numbering to board numbering
gpio.setup(7, gpio.IN) # Set up pin 7 as an input
gpio.add_event_detect(7, gpio.RISING, callback=shutdown, bouncetime=200) # Set up an interrupt to look for button presses
loop() # Run the loop function to keep script running
Code: Select all
import RPi.GPIO as GPIO
# Define a function to keep script running
def loop():
raw_input()
# Define a function to run when an interrupt is called
def LEDON(pin):
GPIO.output(25, True)
GPIO.setmode(GPIO.BCM) #Set pin numbering to GPIO numbering
GPIO.setup(24, GPIO.IN) # Set up GPIO 24 as an input (button)
GPIO.setup(25, GPIO.OUT) # Set GPIO 25 as an output (LED)
GPIO.output(25, False)
GPIO.add_event_detect(24, GPIO.RISING, callback=LEDON, bouncetime=200)
loop() # Run the loop function to keep script running
Code: Select all
fi
python /home/pi/scripts/PiSupply/softshut.py
python /home/pi/scripts/button/button.py
exit 0
Any help greatly appreciated!!