debug mode
This commit is contained in:
parent
a7b3266114
commit
761278b027
28
calzelarm.py
28
calzelarm.py
@ -1,16 +1,36 @@
|
|||||||
import RPi.GPIO as GPIO
|
import RPi.GPIO as GPIO
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
import argparse
|
||||||
|
|
||||||
CHANNEL = 19
|
CHANNEL = 19
|
||||||
GPIO.setmode(GPIO.BOARD)
|
GPIO.setmode(GPIO.BOARD)
|
||||||
|
|
||||||
|
|
||||||
GPIO.setup(CHANNEL, GPIO.IN)
|
def debug():
|
||||||
|
standby_for = 30
|
||||||
while (True):
|
while standby_for:
|
||||||
if GPIO.input(CHANNEL):
|
if GPIO.input(CHANNEL):
|
||||||
print('Input was HIGH')
|
print('Input was HIGH')
|
||||||
else:
|
else:
|
||||||
print('Input was LOW')
|
print('Input was LOW')
|
||||||
sleep(1)
|
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()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GPIO.cleanup()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user