So, here's the program:
When the Raspberry is started, GPIO40 turns on a LED. I'm using the same output to trigger the input, so I inserted the time delay, otherwise the Raspberry should start the shutdown procedure immediately.
Code: Select all
import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BOARD) GPIO.setup(40, GPIO.OUT) GPIO.output(40, True) time.sleep(1) GPIO.setup(38, GPIO.IN) while True: if(GPIO.input(38)): os.system("sudo shutdown -h now") break time.sleep(1)
Using the program as it is now, does it have a 1 second delay only because of the time.sleep in the while loop, or do I have 2 seconds in total because the whole program running ?
Many thanks in advance...