@@ -57,15 +57,51 @@ uint16_t global_pause = 1;
57
57
58
58
void loop () {
59
59
// Some example procedures showing how to display to the pixels
60
- colorWipe (Color (25 , 50 , 25 ), 1 );
60
+ colorWipe (Color (25 , 75 , 25 ), 1 );
61
+ // Serial.println(rgbColorsString(strip.getPixelColor(10)));
62
+ delay (5 );
63
+ brighter2 (2.0 );
64
+ Serial.println (" after brighter:" );
61
65
Serial.println (rgbColorsString (strip.getPixelColor (10 )));
62
- delay (500 );
63
- brighter2 (2 );
64
- Serial.println (rgbColorsString (strip.getPixelColor (10 )));
65
- delay (500 );
66
- brighter2 (1.5 );
67
- Serial.println (rgbColorsString (strip.getPixelColor (10 )));
68
- delay (500 );
66
+ delay (5 );
67
+ // brighter2(1.5);
68
+ // Serial.println(rgbColorsString(strip.getPixelColor(10)));
69
+ delay (5 );
70
+ }
71
+
72
+
73
+ void brighter2 (float amount){
74
+ int i;
75
+ float incr, incg, incb;
76
+ for (i=0 ;i < stripLen; i++) {
77
+ uint32_t scolor = strip.getPixelColor (i);
78
+ rgbInfo_t rgb_info = unpackColors (scolor);
79
+
80
+ if (rgb_info.r * amount <= 254 ) {
81
+ Serial.println (" STARTING" );
82
+ Serial.println (rgb_info.r );
83
+ rgb_info.r = int (rgb_info.r * amount);
84
+
85
+ Serial.println (rgb_info.r );
86
+ }
87
+ else continue ;
88
+
89
+ if (rgb_info.g * amount <= 254 ) {
90
+ rgb_info.g = int (rgb_info.g * amount);
91
+ }
92
+ else continue ;
93
+
94
+ if (rgb_info.b * amount <= 254 ) {
95
+ rgb_info.b = int (rgb_info.b * amount);
96
+ }
97
+ else continue ;
98
+ Serial.println (rgb_info.r );
99
+ strip.setPixelColor (i, Color ( rgb_info.r ,
100
+ rgb_info.g ,
101
+ rgb_info.b ));
102
+
103
+ }
104
+ strip.show ();
69
105
}
70
106
71
107
// public stuff
@@ -179,37 +215,6 @@ void maxOut() {
179
215
}
180
216
}
181
217
182
- void brighter2 (float amount){
183
- int i;
184
- float incr, incg, incb;
185
- for (i=0 ;i < stripLen;i++) {
186
- uint32_t scolor = strip.getPixelColor (i);
187
- rgbInfo_t rgb_info = unpackColors (scolor);
188
-
189
- if (rgb_info.r * amount <= 255 ) {
190
- rgb_info.r = int (rgb_info.r * amount);
191
- }
192
- else break ;
193
-
194
- if (rgb_info.g * amount <= 255 ) {
195
- rgb_info.g = int (rgb_info.g * amount);
196
- }
197
- else break ;
198
-
199
- if (rgb_info.b * amount <= 255 ) {
200
- rgb_info.b = int (rgb_info.b * amount);
201
- }
202
- else break ;
203
-
204
- strip.setPixelColor (i, Color ( rgb_info.r ,
205
- rgb_info.g ,
206
- rgb_info.b ));
207
- // this here shows the diff one pixel at a time.
208
- // to make it just show the whole thing, move past bracket.
209
- // is only going to matter if a LOT of crap is going on in ard.
210
- strip.show ();
211
- }
212
- }
213
218
214
219
// how much brighter
215
220
// known issue here: if you have pixels with a color at 255 already,
@@ -337,7 +342,7 @@ rgbInfo_t unpackColors(uint32_t c){
337
342
return (rgb_info);
338
343
}
339
344
340
- // untested
345
+
341
346
// give it a Color value and it gives you a string with RGB. For troubleshooting.
342
347
String rgbColorsString (uint32_t c){
343
348
rgbInfo_t rgb_info = unpackColors (c);
0 commit comments