Skip to content

Instantly share code, notes, and snippets.

@kasperkamperman
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasperkamperman/74c9b14959f273323b91 to your computer and use it in GitHub Desktop.
Save kasperkamperman/74c9b14959f273323b91 to your computer and use it in GitHub Desktop.
HexaWS2811 test on Arduino with FastLED 2.1
// Check HsvGammaTest.ino for a more up to date version
// https://gist.github.com/kasperkamperman/3f5415d609c176f3da74
// Gamma table HexaWS2811
const uint8_t gammaTable[]PROGMEM={
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x5,0x5,0x5,0x5,0x5,0x5,0x5,0x6,0x6,0x6,0x6,0x6,0x6,0x6,0x7,0x7,0x7,0x7,0x7,0x8,0x8,0x8,0x8,0x8,0x9,0x9,0x9,0x9,0xa,0xa,0xa,0xa,0xb,0xb,0xb,0xb,0xc,0xc,0xc,0xd,0xd,0xd,0xd,0xe,0xe,0xe,0xf,0xf,0x10,0x10,0x10,0x11,0x11,0x11,0x12,0x12,0x13,0x13,0x14,0x14,0x15,0x15,0x16,0x16,0x17,0x17,0x18,0x18,0x19,0x19,0x1a,0x1b,0x1b,0x1c,0x1c,0x1d,0x1e,0x1e,0x1f,0x20,0x21,0x21,0x22,0x23,0x24,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x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x8b,0x8e,0x91,0x94,0x97,0x9a,0x9e,0xa1,0xa5,0xa8,0xac,0xb0,0xb4,0xb8,0xbc,0xc0,0xc4,0xc8,0xcd,0xd1,0xd6,0xdb,0xdf,0xe4,0xe9,0xee,0xf4,0xf9
};
#include "FastLED.h"
#define NUM_LEDS 24
#define DATA_PIN 11
const int potPin = 0;
CRGB leds[NUM_LEDS];
// debug duration
unsigned long t1; // for measuring purposes
unsigned long t2; // for measuring purposes
unsigned long t3 = 0; // for measuring purposes
int ditherFrame = 0;
CRGB pixel;
// fadeing
unsigned long previousMillis = 0;
unsigned long currentMillis = 0;
const int interval = 1000/50;
int fadeVal = 255;
int fadeSpeed = 1;
int hue = 0;
int brightness;
int rgb_colors[3];
void setup()
{ //FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
//FastLED.setBrightness(128);
FastLED.setDither(0);
Serial.begin(57600);
getRGB(120,255,fadeVal,rgb_colors);
}
void loop() {
currentMillis = millis();
setTime();
if (currentMillis - previousMillis >= interval == true ) {
hue = map(analogRead(potPin), 0, 1023, 0, 359);
// cycle hue
//hue++;
//if(hue>359) hue = 0;
fadeVal = fadeVal + fadeSpeed; // change fadeVal by speed
fadeVal = constrain(fadeVal, 0, 255); // keep fadeVal between 0 and 255
if(fadeVal==255 || fadeVal==0) // change from up>down or down-up (negative/positive)
{ fadeSpeed = -fadeSpeed;
}
//fadeVal = 200;
getRGB(hue,255,fadeVal,rgb_colors); // converts HSB to RGB
previousMillis = currentMillis;
}
for (int i=0; i <NUM_LEDS; i++)
{
// use my own HSVRGB code to compare (not brilliant either)
// pixel.r = rgb_colors[0];
// pixel.g = rgb_colors[1];
// pixel.b = rgb_colors[2];
// using FastLED gives a strange behavior primaries are a lot brighter.
// changed all the hsv2rgb_rainbow function calls in pixeltypes.h to hsv2rgb_spectrum
// so no correction should be active
// SOLUTION apply brightness dithering on brightness value and not on the separate rgb components
pixel = CHSV(map(hue,0,359,0,255),255,pgm_read_byte_near(gammaTable + (ditherFrame<<8) + (fadeVal)));
//doesn't give a pleasing result
//pixel = CHSV(map(hue,0,359,0,255),255,fadeVal);
//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();
printTime();
}
void setTime()
{ t1 = micros();
}
void printTime()
{
t2 = micros()-t1;
if(t2>t3) t3 = t2;
Serial.print(F("update time: "));
Serial.print(t3);
Serial.print(" ");
Serial.println(t2);
}
// my own slow code, just to check if dimming code is active in FastLED
void getRGB(int hue, int sat, int val, int colors[3]) {
/* convert hue, saturation and brightness ( HSB/HSV ) to RGB
The dim_curve is used only on brightness/value and on saturation (inverted).
This looks the most natural.
*/
//val = dim_curve[val];
//sat = 255-dim_curve[255-sat];
//sat = 255-sat;
int r;
int g;
int b;
int base;
if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
colors[0]=val;
colors[1]=val;
colors[2]=val;
} else {
base = ((255 - sat) * val)>>8;
switch(hue/60) {
case 0:
r = val;
g = (((val-base)*hue)/60)+base;
b = base;
break;
case 1:
r = (((val-base)*(60-(hue%60)))/60)+base;
g = val;
b = base;
break;
case 2:
r = base;
g = val;
b = (((val-base)*(hue%60))/60)+base;
break;
case 3:
r = base;
g = (((val-base)*(60-(hue%60)))/60)+base;
b = val;
break;
case 4:
r = (((val-base)*(hue%60))/60)+base;
g = base;
b = val;
break;
case 5:
r = val;
g = base;
b = (((val-base)*(60-(hue%60)))/60)+base;
break;
}
colors[0]=r;
colors[1]=g;
colors[2]=b;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment