-
Notifications
You must be signed in to change notification settings - Fork 0
/
blyncFunRGB.py
75 lines (62 loc) · 1.81 KB
/
blyncFunRGB.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
'''################################
#
#Playing with the BlyncLight
# only in RGB this time
#Brandon Brocker ([email protected])
#Usage: python blyncFunRGB.py
#
################################'''
#imports
from blynclight import BlyncLight
#import colorsys
import time
#declariations
light = BlyncLight.get_light() #la luz
cycleTime = 60 #number of hours (in seconds for sleep()) as a formula
steps = 512+512+512 #2*256 steps per color
color = (255, 0, 0) #start with red
#NOTE: (red,blue,green)!!!
#setup
light.on = True
while(True):
#increase green
for green in range(0,255,1):
color = (color[0],color[1],green)
light.color = color
#wait until next update
time.sleep(cycleTime/steps)
#decrease red
for red in range(255,0,-1):
color = (red,color[1],color[2])
light.color = color
#wait until next update
time.sleep(cycleTime/steps)
#increase blue
for blue in range(0,255,1):
color = (color[0],blue,color[2])
light.color = color
#wait until next update
time.sleep(cycleTime/steps)
#decrease green
for green in range(255,0,-1):
color = (color[0],color[1],green)
light.color = color
#wait until next update
time.sleep(cycleTime/steps)
#increase red
for red in range(0,255,1):
color = (red,color[1],color[2])
light.color = color
#wait until next update
time.sleep(cycleTime/steps)
#decrease blue
for blue in range(255,0,-1):
color = (color[0],blue,color[2])
light.color = color
#wait until next update
time.sleep(cycleTime/steps)
#teardown
light.on = False
'''#useful color values
True-ish white: (215,235,145)
'''