I have a PI B and i am having a bit of trouble with my GPIO pins. I am running a simple script to check if a button has been pressed that is hooked up up to pin 7. The problem is as soon as i conntect the jumper cable to the pi (other end is free) the script starts saying that the button is pressed. This is before the pi is even hooked up to the breadboard.
import RPi.GPIO as GPIO import time buttonPin = 7 GPIO.setmode(GPIO.BOARD) GPIO.setup(buttonPin,GPIO.IN) if (GPIO.input(buttonPin)): print("pressed") time.sleep(0.2)