I'm working on a very basic doorbell raspberry pi project, by following this post: https://harizanov.com/2013/07/raspberry-pi-emalsms-doorbell-notifier-picture-of-the-person-ringing-it/
however, i'm getting a very strange behavior, can anyone explain the cause to me? or how to fix it?
the symptom: random voltage when I'm monitoring the GPIO input
the code:
GPIO.setmode(GPIO.BOARD)
GPIO.setup(buttonPin,GPIO.IN)
while True:
sleep(1)
if (GPIO.input(11)):
print "000"
else:
print "xxx"
the result: xxx xxx xxx 000 000 000 xxx xxx xxx 000 000
since the GPIO17(11) and GPIO Ground(9) are not powered at all, why I'm getting the random HIGH and LOW for the input?
PS: the symptom only happens when there are two wires connect to the GPIO17 and GND, or any other Green pin with GND, if I remove the wire from the GPIO, the result shows XXX only
tks in advance