Use GPIO.HIGH and GPIO.LOW for ON and OFF

It's even more obvious than 1 and 0!

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2015-04-23 10:28:04 -04:00
parent dc4e67d51b
commit 40ee611f33
2 changed files with 5 additions and 4 deletions

View File

@ -49,9 +49,8 @@ GPIO.setup(GREEN_LED, GPIO.OUT)
GPIO.setup(YELLOW_LED, GPIO.OUT)
#Be explicit with what we want
OFF = 0 # Low voltage, ground
ON = 1 # High voltage
OFF = GPIO.LOW
ON = GPIO.HIGH
def unlock_door():

View File

@ -3,12 +3,14 @@ print("Using fake GPIO driver.")
BOARD = "board"
IN = "input"
OUT = "output"
HIGH = 1
LOW = 0
def cleanup():
print("> GPIO: cleaning up!")
def output(pin, voltage):
state = "on" if (voltage == 1) else "off"
state = "ON" if (voltage == HIGH) else "OFF"
print("> GPIO setting pin %s to %s." % (pin, state))
def setmode(mode):