codewithher / CC-Lantern

Wrapper library for programming cultural lanterns.
GNU General Public License v3.0
0 stars 0 forks source link

[Feature] Add color wheel to library #21

Open totally-not-frito-lays opened 7 months ago

totally-not-frito-lays commented 7 months ago

Is your feature request related to a problem? Please describe. The Color Wheel Activity is great but after discussion, @innaamogolonova and @totally-not-frito-lays decided that this function is better left blackboxed to the students. We'll migrate this into the library as a dedicated function alternative to the setColor(r,g,b).

Describe the solution you'd like Implement / copy this into the existing library functions. We'll need changes to these files:

Requirements

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  }
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}

Describe alternatives you've considered We considered leaving the implementation as a written function in examples but this is troublesome because:

Additional context Add any other context or screenshots about the feature request here.