I am using an NES as a Pi case. I want to wire the power button to the Pi to do some commands. I have connected one cable to GPIO 1 and another with a 10K Ohm resistor to GPIO 17. I found this command to perform a button press:
import RPi.GPIO as gpio
gpio.setmode(gpio.BCM)
gpio.setup(17, gpio.IN)
while True:
input_value = gpio.input(17)
if input_value == False:
print('The button has been pressed...')
while input_value == False:
input_value = gpio.input(17)
However, whenever I run it, it constantly reads "The button has been pressed..." and pressing in the button makes it stop. How should I rewrite this script to make it display a message when the button is NOT pressed (but, is really pressed on my console)?
BTW-I am a complete novice to the Pi/Python. :)