-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·47 lines (38 loc) · 1.12 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/python3
"""Wrapper for python GPIO code"""
# standard includes
import argparse
# our includes
from src.python.GPIOBase import GPIOBase
if __name__ == "__main__":
# create gpio handler obj
gpioHandler = GPIOBase()
# command CLI args
parser = argparse.ArgumentParser(description="Basic GPIO Controller")
parser.add_argument(
"-m", "--mode",
required=True,
help="Which action to perform",
choices=list(gpioHandler.getModeList())
)
parser.add_argument(
"--colors",
type=str,
nargs="+", # accept multiple args and store in list
required=False,
help="Which Led-Button Pairs (multiple) to use. Space seperated",
choices=list(gpioHandler.getBtnLedPairNames()),
dest="nameLi",
default=[]
)
parser.add_argument(
"--interval",
type=float,
required=False,
help="The interval to blink the LEDs",
default=1
)
# actually parse flags
args = parser.parse_args()
# call entered function
gpioHandler.run(args.mode, args.nameLi, args.interval)