Skip to content

Question Arduino implementation #1

@kasperkamperman

Description

@kasperkamperman

I try to implement your code in Arduino, by storing the array in PROGMEM and using it to modify pixel values. I use FastLED so my updates are fast (about 1ms for noise, sending pixels and more)

Still I don't get the right effect, so I might still miss something. What happens in the two functions below?

#define fb2color(n,shiftin,shiftout) ((gammaTableDithered[ (n>>shiftin)&0xff ])<<shiftout)
#define adjustRGB(rgb)  (fb2color(rgb,16,0) | fb2color(rgb,8,8) | fb2color(rgb,0,16))

What does do parts fb2color(rgb,16,0) etc. do? Right now the gamma is not stable, but different colors get a different brightness. The primaries (r,b,g) are really bright the other colors not.

I ported your code to Arduino like below. I hope you can help.

for (int i=0; i <NUM_LEDS; i++)
{ 
     CRGB pixel = CHSV(hue,255,noise[i]);

     pixel.r = pgm_read_byte_near(gammaTable + (ditherFrame<<8) + (pixel.r));
     pixel.g = pgm_read_byte_near(gammaTable + (ditherFrame<<8) + (pixel.g));
     pixel.b = pgm_read_byte_near(gammaTable + (ditherFrame<<8) + (pixel.b));

     leds[i] = pixel;
}

ditherFrame++;
if(ditherFrame>15) ditherFrame = 0;

FastLED.show();

In this post on the FastLED support site I refer to your code:
https://plus.google.com/100115767703084101160/posts/483GAFbQJiL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions