Add basic version of code

This commit is contained in:
Ben Nuttall
2015-09-14 11:04:39 +01:00
parent 95118e504d
commit 4d19a10547
3 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
from RPi import GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
class InputDevice(object):
def __init__(self, pin):
self.pin = pin
GPIO.setup(pin, GPIO.IN, GPIO.PUD_UP)
def is_pressed(self):
return GPIO.input(self.pin) == 0
class Button(InputDevice):
pass