Last active
July 31, 2018 23:58
-
-
Save kbostick88/5155d64407e19efadaf0111a38d40cea to your computer and use it in GitHub Desktop.
Palette test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
}; |
Author
kbostick88
commented
Jul 31, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment