I've enabled the internal Pull-Up resistor and set the pin as INPUT in the script, but no matter what, I can't get the pin to do anything. I know that without the pin connected to anything, and the Pull-Up Resistor enabled, I should be seeing 3.3VDC. However, with a DMM, it reads about 150mV to ground (without the button wire connected).
Here's my code:
Code: Select all
import RPi.GPIO as GPIO
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def psReset(channel)
os.system("sudo shutdown -r now")
GPIO.add_event_detect(21, GPIO.RISING, callback = psReset, bouncetime = 250)
I've run the following script manually from PuTTy using the command:
Code: Select all
sudo python /home/pi/reboot.py
I've double- and triple-checked that I'm on the correct pin (physical board 40; GPIO21).
What could I be doing wrong?