debug mode
This commit is contained in:
parent
a7b3266114
commit
761278b027
36
calzelarm.py
36
calzelarm.py
@ -1,16 +1,36 @@
|
||||
import RPi.GPIO as GPIO
|
||||
from time import sleep
|
||||
import argparse
|
||||
|
||||
CHANNEL = 19
|
||||
GPIO.setmode(GPIO.BOARD)
|
||||
|
||||
|
||||
GPIO.setup(CHANNEL, GPIO.IN)
|
||||
def debug():
|
||||
standby_for = 30
|
||||
while standby_for:
|
||||
if GPIO.input(CHANNEL):
|
||||
print('Input was HIGH')
|
||||
else:
|
||||
print('Input was LOW')
|
||||
sleep(1)
|
||||
standby_for -= 1
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--debug', action='store_true',
|
||||
help='Enables the DEBG opcode')
|
||||
args = parser.parse_args()
|
||||
|
||||
GPIO.setup(CHANNEL, GPIO.IN)
|
||||
|
||||
if args.debug:
|
||||
debug()
|
||||
GPIO.cleanup()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
|
||||
while (True):
|
||||
if GPIO.input(CHANNEL):
|
||||
print('Input was HIGH')
|
||||
else:
|
||||
print('Input was LOW')
|
||||
sleep(1)
|
||||
|
||||
GPIO.cleanup()
|
||||
|
Loading…
Reference in New Issue
Block a user