-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPorch Lights
243 lines (153 loc) · 4.21 KB
/
Porch Lights
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#include <FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 100
int lights[NUM_LEDS + 1];
int colorSelect = 0;
CRGB leds[NUM_LEDS];
void setup() {
Serial.begin(9600);
FastLED.addLeds<WS2811, LED_PIN, GRB>(leds, NUM_LEDS);
}
void loop() {
Sequence1();
}
void Sequence1() {
int wait = 5000; // minutes
int pulse = 100;
SetColor(0, 255, 0);
delay(wait);
ColorClimbUp(pulse, 0,255,125);
delay(wait);
ColorClimbUp(pulse, 0,0,255);
delay(wait);
ColorClimbUp(pulse, 125,0,255);
delay(wait);
ColorClimbUp(pulse, 0,255,0);
}
void MixedLights2(int red1, int green1, int blue1, int red2, int green2, int blue2, int red3, int green3, int blue3, int red4, int green4, int blue4, int red5, int green5, int blue5) {
for (int place = 0; place <= NUM_LEDS; place = place+5) {
leds[place] = CRGB(green1, red1, blue1);
leds[place+1] = CRGB(green2, red2, blue2);
leds[place+2] = CRGB(green3, red3, blue3);
leds[place+3] = CRGB(green4, red4, blue4);
leds[place+4] = CRGB(green5, red5, blue5);
}
FastLED.show();
}
void MixedLights1(int red1, int green1, int blue1, int red2, int green2, int blue2, int red3, int green3, int blue3) {
for (int place = 0; place <= NUM_LEDS; place = place+3) {
leds[place] = CRGB(green1, red1, blue1);
leds[place+1] = CRGB(green2, red2, blue2);
leds[place+2] = CRGB(green3, red3, blue3);
}
FastLED.show();
}
void ChristmasFade() {
int green = 0;
int red = 0;
int blue = 0;
int pulse = 2.5;
int wait = 1000;
SetColor(255, 0, 0);
delay(wait);
for (int i = 0; i < 255; i++) {
red--;
green++;
SetColor(red, green, blue);
delay(pulse);
}
SetColor(0, 255, 0);
delay(wait);
red = 0;
blue = 0;
green = 255;
for (int i = 0; i < 255; i++) {
red++;
blue++;
SetColor(red, green, blue);
delay(pulse);
}
SetColor(255, 255, 255);
delay(wait);
red = 255;
green = 255;
blue = 255;
for (int i = 0; i < 255; i++) {
green--;
blue--;
SetColor(red, green, blue);
delay(pulse);
}
delay(wait);
}
void SetThreeColors(int topRed, int topGreen, int topBlue, int midRed, int midGreen, int midBlue, int bottomRed, int bottomGreen, int bottomBlue) {
int sectionDivider = NUM_LEDS / 3;
//bottom
for(int place = 0; place <= sectionDivider; place++) {
leds[place] = CRGB(bottomGreen, bottomRed, bottomBlue);
}
FastLED.show();
//middle
for(int place = sectionDivider; place <= sectionDivider * 2; place++) {
leds[place] = CRGB(midGreen, midRed, midBlue);
}
FastLED.show();
//top
for(int place = sectionDivider * 2; place <= (sectionDivider * 3); place++) {
leds[place] = CRGB(topGreen, topRed, topBlue);
}
FastLED.show();
}
void SetColor(int red, int green, int blue) {
//fill
for(int place = 0; place <= NUM_LEDS; place++) {
leds[place] = CRGB(green, red, blue);
}
FastLED.show();
}
void ColorSwitch(int initialRed, int initialGreen, int initialBlue, int newRed, int newGreen, int newBlue) {
//fill
for(int place = 0; place <= NUM_LEDS; place++) {
leds[place] = CRGB(initialGreen, initialRed, initialBlue);
}
FastLED.show();
//newColor
for(int place = 0; place <= NUM_LEDS; place++) {
leds[place] = CRGB(newGreen, newRed, newBlue);
}
FastLED.show();
}
void ColorClimbUp(int pulse, int red, int green, int blue) {
for(int place = 0; place <= NUM_LEDS; place++) {
leds[place] = CRGB(green, red, blue);
FastLED.show();
delay(pulse);
}
}
void ColorClimbDown(int pulse, int red, int green, int blue) {
for(int place = NUM_LEDS; place >= 0; place--) {
leds[place] = CRGB(green, red, blue);
FastLED.show();
delay(pulse);
}
}
void SparkleColorChange(int pulse, int red, int green, int blue) {
//sparkle
for (int i = 0; i <= NUM_LEDS + 1; i++) {
lights[i] = i;
}
size_t n = sizeof(lights) / sizeof(lights[0]);
for (size_t i = 0; i < n - 1; i++) {
size_t j = random(0, n - i);
int t = lights[i];
lights[i] = lights[j];
lights[j] = t;
}
for(int i = 0; i <= NUM_LEDS-1; i++) {
int place = lights[i];
Serial.println(place);
leds[place] = CRGB(green, red, blue);
delay(pulse);
FastLED.show();
}
}