i bought a pi 2 B last week with a ready to use 16x2 Display + Keyboard wich i pluged in the gpio pins. It looks exactly like this picture: When i start the pi, the background display lights up like discribed in the manual here. I tried to use the display or the buttons serveral times with the example code in the manual and others, and i think the gpio pins dont work. Here is my script just to check the input of the buttons. Because its possible that i use the wrong pins, the code checks each of the 26 pins connected. I hold down every button many times, but the script doesnt recieve any change of the pin inputs. Here is my code:
import time import RPi.GPIO as GPIO INPUTS = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] def InitIO(): GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) for x in range(1,27): print x GPIO.setup(x, GPIO.IN, pull_up_down=GPIO.PUD_UP) INPUTS[x]=GPIO.input(x) print "Pi button test program starting" InitIO() print "Standart pin input : " print INPUTS while (True): for x in range (1,27): if INPUTS[x] != GPIO.input(x): print "PIN changed : ",x time.sleep(1)
I tried the Display with some other code, and it doesnt work too.
What am I doing wrong ?
I execute the script with
sudo python test.py
Is the Display and the Keyboard broken ? :(