Im new to python, coming from PHP so i hardly understand it.
I have a very basic "launch switch" attached to GPIO 23 & GPIO GND and am running this python.
Code: Select all
import time import RPi.GPIO as io io.setmode(io.BCM) door_pin = 23 io.setup(door_pin, io.IN) counter = 0 while True: if io.input(door_pin): counter += 1 print "Switch:", counter time.sleep(0.5)
Another slight problem, is that it does not tick smoothly, as in a get a response every half second or so for about 11 ticks, then it pauses, then another 11 or so ticks then it pauses...