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)
|
||||
|
||||
|
||||
#Be explicit with what we want
|
||||
OFF = 0 # Low voltage, ground
|
||||
ON = 1 # High voltage
|
||||
OFF = GPIO.LOW
|
||||
ON = GPIO.HIGH
|
||||
|
||||
|
||||
def unlock_door():
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue