8

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.

Matthew
  • 81
  • 1
  • 1
  • 2

2 Answers2

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.

Regards,

Steve

Stese
  • 232
  • 1
  • 7
-2

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......