I found small problem with my Raspberry model B. I have a simple circuit - GPIO input on raspberry and button with 10k resistor (connected same way like on this page: https://www.cl.cam.ac.uk/projects/raspb ... _switches/). And I have this simple python script for detecting button pushes:
This everythink works as expected - I run script, nothing happen, when I push button script will print detected 25. But accidentally I found other way how to simulate button push without touching it. I take long copper wire (I tested it with cable to my volt meter) and touch with it any pin on GPIO header - no matter if it's +5V, ground, other GPIO... and script also detect button push on my pin. Has anybody some idea how to prevent raspberry detect input in this case? Or did I something wrong?
Code: Select all
#!/usr/bin/python import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(25, GPIO.IN) def button_press(pin): print "detected", pin GPIO.add_event_detect(25, GPIO.RISING, callback=button_press) raw_input('test') GPIO.cleanup()