-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathledout.py
More file actions
65 lines (62 loc) · 1.61 KB
/
ledout.py
File metadata and controls
65 lines (62 loc) · 1.61 KB
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
55
56
57
58
59
60
61
62
63
64
65
import RPi.GPIO as IO #calling header file which helps us use GPIO’s of PI
from user import *
from theme import *
import time #calling time to provide delays in program
quiet_color = (0,1)
engaged_color = (1,0)
normal_color = (0,0)
warm_color = (1,1)
predefined_themes = {quiet:quiet_color, engaged:engaged_color, normal:normal_color,warm:warm_color}
IO.setwarnings(False) #do not show any warnings
IO.setmode (IO.BCM) #we are programming the GPIO by BCM pin numbers. (PIN35 as ‘GPIO19’)
IO.setup(23,IO.OUT)
IO.setup(24,IO.OUT)
#IO.cleanup()
# # setup all blue
# IO.setup(13,IO.OUT)
# IO.setup(16,IO.OUT)
# IO.setup(18,IO.OUT)
#
# # setup all green
# IO.setup(19,IO.OUT)
# IO.setup(20,IO.OUT)
# IO.setup(23,IO.OUT)
#
# # setup all red
# IO.setup(21,IO.OUT)
# IO.setup(24,IO.OUT)
# IO.setup(26,IO.OUT)
#
# blue_1 = IO.PWM(13,100)
# blue_2 = IO.PWM(16,100)
# blue_3 = IO.PWM(18,100)
#
# green_1 = IO.PWM(19,100)
# green_2 = IO.PWM(20,100) #generate PWM signal with 0% duty cycle
# green_3 = IO.PWM(23,100)
#
# red_1 = IO.PWM(21,100)
# red_2 = IO.PWM(24,100)
# red_3 = IO.PWM(26,100)
#
#
def change_color(theme):
print(theme)
IO.output((23,24),predefined_themes[theme])
# ## B, G, R for themes
# color_space = predefined_themes[theme]
# b,g,r = color_space
#
# blue_1.start(b)
# # blue_2.start(b)
# blue_3.start(b)
# green_1.start(g)
# #green_2.start(g)
# green_3.start(g)
# red_1.start(r)
# # red_2.start(r)
# red_3.start(r)
if __name__ == "__main__":
change_color(normal)
#
# #IO.cleanup()#turn lights off