I considered myself out of this sort of beginner level stuff a long time ago, but I guess I'm not as smart as I thought I was because I seem to be having an exceptional level of trouble with it!
So I've finally finished exams and can play with my new toy, so the first thing I did was get an LCD character display rigged up over UART. I got that working no problem, so I am having a really hard time figuring out why I am having such a hard time with this button!
So I've set up a button similar to the way one would with an arduino; with a 1k resistor connecting to ground. I used my multimeter to ensure that the button was working and putting out the right amount of power, which it is. I SSH into my shell, plug the button into GPIO pin 7 and went into python. Here's what I tried:
GPIO.pinout(GPIO.BOARD)
GPIO.setup(7,GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
while 1==1:
inputval = GPIO.input(7)
print inputval
This gives me an endless loop of False
regardless of how I press the button. I tried it with GPIO.PUD_UP
as well and got an endless loop of True
instead. I also tried it with GPIO.PUD_OFF
and got more False
.
Am I missing something here?
GPIO.PUD_UP
. What voltage do you see withGPIO.PUD_UP
on and the button pressed? – John La Rooy Aug 21 '12 at 01:07