Are you sure everything is correct in your attempts? There could be quite a lot of software reasons for it not working.
When you run the python install have you check if install is OK?
sudo apt-get install python-dev
sudo apt-get install python3-dev
sudo apt-get install gcc
sudo apt-get install python-pip
Are you connected to internet while doing it?
Have you checked if the python version you installed (maybe installed from first tutorial) is same version with the latest script posted on the forum? If oone is 2.7 and other is 3.x there can be some syntax problems.
Best to confirm if it's hardware defect would be to make a script that print some string in the console when buttons is pushed. So you can see if there are errors or if button just don't work.
Just put this example script (name file test.py) to your root folder of your SD card then type in the console "sudo python /boot/test.py"
See if the script is launching.
Not sure of the code I have not tried it.
Code: Select all
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import subprocess
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN, pull_up_down = GPIO.PUD_UP)
oldButtonState1 = True
print("script started")
while True:
#grab the current button state
buttonState1 = GPIO.input(11)
# check to see if button has been pushed
if buttonState1 != oldButtonState1 and buttonState1 == False:
print("button working!")
oldButtonState1 = buttonState1
time.sleep(.1)