Skip to content

Commit 65eb264

Browse files
Add BrightWheel
Use BrightWheel for selecting colors from a palette. It uses maximum luminocity for every color. Use SmoothWheel for color fades. It uses a more consistant luminocity for every color.
1 parent 4bc0235 commit 65eb264

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

Receiver_test/Receiver_test.ino

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void loop(void){
170170
case 2: // rainbow rotating around
171171
n = (addr-1) * 16;
172172
while(!done){
173-
setLantern(Wheel((64 + n) & 255));
173+
setLantern(SmoothWheel((64 + n) & 255));
174174
delay(rate);
175175
n++;
176176
done = process_msg();
@@ -193,7 +193,7 @@ void loop(void){
193193

194194
// Input a value 0 to 255 to get a color value.
195195
// The colours are a transition r - g - b - back to r.
196-
uint32_t Wheel(byte WheelPos){
196+
uint32_t SmoothWheel(byte WheelPos){
197197
WheelPos = 255 - WheelPos;
198198
if(WheelPos < 85){
199199
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
@@ -206,6 +206,27 @@ uint32_t Wheel(byte WheelPos){
206206
}
207207
}
208208

209+
uint32_t BrightWheel(byte WheelPos){
210+
// 6 phases for each color
211+
// fades in for 1 cycle
212+
// stays for 2 cycles
213+
// fades out for 1 cycle
214+
// stays out for 2 cycles
215+
if(WheelPos < 43){
216+
return strip.Color(255, WheelPos * 6, 0);
217+
}else if(43 <= WheelPos && WheelPos < 85){
218+
return strip.Color(255 - (WheelPos - 43) * 6, 255, 0);
219+
}else if(85 <= WheelPos && WheelPos < 128){
220+
return strip.Color(0, 255, (WheelPos - 85) * 6);
221+
}else if(128 <= WheelPos && WheelPos < 170){
222+
return strip.Color(0, 255 - (WheelPos - 128) * 6, 255);
223+
}else if(170 <= WheelPos && WheelPos < 213){
224+
return strip.Color((WheelPos - 170) * 6, 0, 255);
225+
}else{
226+
return strip.Color(255, 0, 255 - (WheelPos - 213) * 6);
227+
}
228+
}
229+
209230
bool check_radio(void){
210231
if(radio.available()){
211232
timeout = millis() + 10000;

0 commit comments

Comments
 (0)