-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotification_Lights.py
54 lines (34 loc) · 1.1 KB
/
Notification_Lights.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
48
49
50
51
52
53
54
#!/usr/bin/python
import signal
import sys
import time
import RPi.GPIO as io
io.setmode(io.BCM)
io.setwarnings(False)
####################### SIGNAL HANDLER TO CATCH CTRL+C ##########################
# Setup signal handler to catch ctrl+c detectGPIOn and exit cleanly #
###################################################################################
def signal_handler(signal, frame):
print(" ")
print("Ctrl+C detected...")
print(" ")
io.cleanup()
sys.exit(0)
# set signal handler #
signal.signal(signal.SIGINT, signal_handler)
# #
####################### SIGNAL HANDLER TO CATCH CTRL+C END ########################
ledPin = 17
# set up io output channel
io.setup(17, io.OUT)
#
# blinking function
def blink(pin):
io.output(pin, io.HIGH)
time.sleep(1)
io.output(pin, io.LOW)
time.sleep(1)
return
def fblink():
for i in range(0, 50):
blink(17)