Skip to content

Instantly share code, notes, and snippets.

@kbostick88
Last active July 31, 2018 23:58
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 kbostick88/5155d64407e19efadaf0111a38d40cea to your computer and use it in GitHub Desktop.
Save kbostick88/5155d64407e19efadaf0111a38d40cea to your computer and use it in GitHub Desktop.
Palette test
#include <FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 99
#define BRIGHTNESS 150
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
CRGBPalette16 currentPalette;
TBlendType currentBlending;
extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;
void setup() {
Serial.begin(57600);
// delay( 3000 ); // power-up safety delay
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS+1).setCorrection( TypicalLEDStrip );
//FastLED.addLeds<LED_TYPE, LED_PIN, CLK_PIN, COLOR_ORDER>(leds, NUM_LEDS+1).setCorrection( TypicalLEDStrip );
FastLED.setBrightness( BRIGHTNESS );
currentPalette = myRedWhiteBluePalette_p;
currentBlending = NOBLEND;
}
void loop()
{
EVERY_N_MILLIS(50) // Use this instead of delays. In this case, we really don't need it.
{
myfiller();
}
FastLED.show();
}
void myfiller()
{
for (int i = 0; i<6;i++) {
CRGB color = ColorFromPalette(currentPalette, i*16);
fill_solid(leds+i*5, 5, color);
}
} // myfiller()
const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM =
{
CRGB::White,
CRGB::Red, // 'white' is too bright compared to red and blue
CRGB::Green,
CRGB::Yellow,
CRGB::Blue,
CRGB::Orange
};
@kbostick88
Copy link
Author

img_9941

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment