I recently have started delving into using the GPIO on my raspberry pi and when I got to the input section of adafruit's tutorials I noticed something wrong. For some reason when I execute the python script to play a song when I push a button it instead immediately acts like I have the button constantly pressed. This results in the songs starting over and over again and forcing me to kill each individually or reboot my pi. I did a small code to test if my theory was correct that would display when my GPIO pins where True and it resulted with them all being True constantly without me pushing the button. I even noticed this behavior when I disconnected the breadboard from the GPIO pins. Something is causing my GPIO pins to be always True and this is a problem for any programs I want to make, please help me.

Link to adafruit tutorial: http://learn.adafruit.com/playing-sounds-and-using-buttons-with-raspberry-pi

I have it wired exactly as in the diagram but it doesn't change anything even if I wire it differently.

  • 1
    Have you looked at this question? GPIO pin output stays high after setting to low.
    – goldilocks
    Mar 15, 2014 at 14:09
  • 1
    The tutorial uses pull-up resistors, so the value is normally HIGH/True, and LOW/False when you press the button. When you disconnect the breadboard, the pins are "floating" and be read as HIGH or LOW (undefined).
    – Gerben
    Mar 15, 2014 at 17:17
  • If it is a pull-up issue, I've written an answer about using the internal resistors of the Pi: raspberrypi.stackexchange.com/questions/14105/…
    – Fred
    Mar 15, 2014 at 19:01
  • 1
    Just a point about the tutorial code, its good practice to use the built in function GPIO.cleanup() which ensures a clean exit after your code has executed. Could be good to put it in a try / finally block as well to practice good things. the cleanup function ensures all ports you've used are reset to inputs, so may well help with your issue if the ports are being left in a floating state which is never a good thing in my book
    – user13523
    Mar 15, 2014 at 21:19
  • The push-buttons I'm using are normally open so it shouldn't be True, unless of course it's True when open.
    – Matthew
    Mar 16, 2014 at 1:20

2 Answers 2


I'd suggest the answer lies in the different logic between your script and how GPIO works.

If you've followed the tutorial for guidance, then the GPIO pins will be configured to show as HIGH when the button is not pressed, and it will go LOW when the button is pressed. (I tend to think in terms of resistance. when the button is not closed, the circuit is in high resistance, and when the circuit closes, the circuit is then in low resistance)

From your comment, it sounds as if your script is expecting the reverse.




A few gpio's stay high. Depending upon whether if you have enabled A few features like SPI etc.....Aleast this is what i have experienced......

  • 1
    Which GPIO's, what proof can you site for this, How can the OP determine this? Oct 6, 2015 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.