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:
parent
dc4e67d51b
commit
40ee611f33
5
doors.py
5
doors.py
|
@ -49,9 +49,8 @@ GPIO.setup(GREEN_LED, GPIO.OUT)
|
||||||
GPIO.setup(YELLOW_LED, GPIO.OUT)
|
GPIO.setup(YELLOW_LED, GPIO.OUT)
|
||||||
|
|
||||||
|
|
||||||
#Be explicit with what we want
|
OFF = GPIO.LOW
|
||||||
OFF = 0 # Low voltage, ground
|
ON = GPIO.HIGH
|
||||||
ON = 1 # High voltage
|
|
||||||
|
|
||||||
|
|
||||||
def unlock_door():
|
def unlock_door():
|
||||||
|
|
|
@ -3,12 +3,14 @@ print("Using fake GPIO driver.")
|
||||||
BOARD = "board"
|
BOARD = "board"
|
||||||
IN = "input"
|
IN = "input"
|
||||||
OUT = "output"
|
OUT = "output"
|
||||||
|
HIGH = 1
|
||||||
|
LOW = 0
|
||||||
|
|
||||||
def cleanup():
|
def cleanup():
|
||||||
print("> GPIO: cleaning up!")
|
print("> GPIO: cleaning up!")
|
||||||
|
|
||||||
def output(pin, voltage):
|
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))
|
print("> GPIO setting pin %s to %s." % (pin, state))
|
||||||
|
|
||||||
def setmode(mode):
|
def setmode(mode):
|
||||||
|
|
Loading…
Reference in New Issue