I am trying to safely shutdown Pi using a button signal through the GPIO. When I include the command "shutdown -h now" in the python script it either gives me a syntax error or says that "shutdown" is not defined. What am I doing wrong and how can I fix it.
A sample of the Code is attached:
.[import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)
While True:
If GPIO.input(23):
shutdown -h now]