NeoPixel gamma

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mikejr88
 
Posts: 36
Joined: Sat Jul 25, 2009 9:46 am

NeoPixel gamma

Post by mikejr88 »

I wonder if I'm on the right track.

Code: Select all

void setup() {
  matrix.begin();
  matrix.setBrightness(40);
}

// eight color intensity steps 0-8
byte red    = 0;
byte green  = 0;
byte blue   = 0;
// 16 bit color input to matrix.Color
uint16_t color   = 0;


void loop() {
  for (uint8_t i=0; i<8; i++){
    matrix.fillScreen(0);
    // step through red
    red = 9 * pow(i,0.65);
    green = 0;
    blue = 0;
    color = matrix.Color(red, green, blue);
    matrix.fillRect(4, 0, 1, 8, color);
    // step through yellow
    red = 9 * pow(i,0.65);
    green = i * 9;
    blue = 0;
    color = matrix.Color(red, green, blue);
    matrix.fillRect(3, 0, 1, 8, color);
    // step through green
    red = 0;
    green = i * 9;
    blue = 0;
    color = matrix.Color(red, green, blue);
    matrix.fillRect(2, 0, 1, 8, color);
    // step through blue
    red = 0;
    green = 0;
    blue = 52 * pow(i,0.803);
    color = matrix.Color(red, green, blue);
    matrix.fillRect(1, 0, 1, 8, color);
    // step through violet
    red = 9 * pow(i,0.65);
    green = 0;
    blue = 52 * pow(i,0.803);
    color = matrix.Color(red, green, blue);
    matrix.fillRect(0, 0, 1, 8, color);
    matrix.show();
    delay(2000);
  }
  delay(2000);
}
Mike

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: NeoPixel gamma

Post by adafruit_support_bill »

I wonder if I'm on the right track.
That depends on where you are trying to go. :)

A little more detail about what you are making, what works, what doesn't etc. would be helpful.

User avatar
mikejr88
 
Posts: 36
Joined: Sat Jul 25, 2009 9:46 am

Re: NeoPixel gamma

Post by mikejr88 »

I have been trying to figure out what combination of values to input into the color method of neomatrix class. The "Howdy" example uses 255 for- red, green and blue. This appears to be wrong, to me. The meaningful values are (31,63,248). Not complaining. I enjoy figuring things out. My forum post goal is - Share what I'm learning and give back to Adafruit.
When I was looking at the matrix class, I saw comments about gamma correction. Thats what lead me to the above code. I'm getting nice colors with that code.
I'm making a really expensive desk light. :-)
Adafruit trellis, arduino, and neopixels.
16 buttons
3 for red, green and blue, seven levels for each color.
3 buttons for different patterns
2 buttons to change brightness
a button for white
an enter button
:)
Mike

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”