@@ -24,12 +24,13 @@ void UpdatePalette();
|
||||
|
||||
// LED configuration
|
||||
#define LED_TYPE WS2812B
|
||||
#define DATA_PIN 1
|
||||
#define NUM_LEDS 7
|
||||
#define COLOR_ORDER RGB
|
||||
#define LED_DATA_PIN 1
|
||||
#define LED_NUM_LEDS 7
|
||||
#define LED_COLOR_ORDER RGB
|
||||
|
||||
#define BRIGHTNESS 96
|
||||
#define FRAMES_PER_SECOND 24
|
||||
#define LED_BRIGHTNESS 96
|
||||
#define LED_FRAMES_PER_SECOND 24
|
||||
#define LED_SETUP_DISPLAY_DELAY 500
|
||||
|
||||
// DATA maintenance configuration
|
||||
#define UPDATE_INTERVAL 10000 // how often do we update de database?
|
||||
@@ -41,7 +42,7 @@ void UpdatePalette();
|
||||
// VARIABLES
|
||||
BLEScan *pBLEScan;
|
||||
|
||||
CRGB leds[NUM_LEDS];
|
||||
CRGB leds[LED_NUM_LEDS];
|
||||
CRGBPalette256 pal;
|
||||
|
||||
std::map<String,uint8_t> deviceDatabase;
|
||||
@@ -72,24 +73,23 @@ void setup() {
|
||||
|
||||
UpdatePalette();
|
||||
|
||||
FastLED.setBrightness(BRIGHTNESS);
|
||||
FastLED.setBrightness(LED_BRIGHTNESS);
|
||||
|
||||
FastLED.delay(1000/FRAMES_PER_SECOND);
|
||||
FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
|
||||
FastLED.addLeds<LED_TYPE,LED_DATA_PIN,LED_COLOR_ORDER>(leds, LED_NUM_LEDS).setCorrection(TypicalLEDStrip);
|
||||
|
||||
fill_solid(leds, NUM_LEDS, CRGB::Red );
|
||||
fill_solid(leds, LED_NUM_LEDS, CRGB::Red );
|
||||
FastLED.show();
|
||||
FastLED.delay(1000);
|
||||
FastLED.delay(LED_SETUP_DISPLAY_DELAY);
|
||||
|
||||
fill_solid(leds, NUM_LEDS, CRGB::Green );
|
||||
fill_solid(leds, LED_NUM_LEDS, CRGB::Green );
|
||||
FastLED.show();
|
||||
FastLED.delay(1000);
|
||||
FastLED.delay(LED_SETUP_DISPLAY_DELAY);
|
||||
|
||||
fill_solid(leds, NUM_LEDS, CRGB::Blue );
|
||||
fill_solid(leds, LED_NUM_LEDS, CRGB::Blue );
|
||||
FastLED.show();
|
||||
FastLED.delay(1000);
|
||||
FastLED.delay(LED_SETUP_DISPLAY_DELAY);
|
||||
|
||||
fill_solid(leds, NUM_LEDS, CRGB::Black );
|
||||
fill_solid(leds, LED_NUM_LEDS, CRGB::Black );
|
||||
FastLED.show();
|
||||
|
||||
startindex = 0;
|
||||
@@ -114,7 +114,7 @@ void loop() {
|
||||
}
|
||||
FillLEDsFromPaletteColors(startindex++);
|
||||
FastLED.show();
|
||||
FastLED.delay(1000/FRAMES_PER_SECOND);
|
||||
FastLED.delay(1000/LED_FRAMES_PER_SECOND);
|
||||
}
|
||||
|
||||
// Blends two CRGB colors using a uint8_t blend amount (0-255)
|
||||
@@ -156,7 +156,7 @@ void CleanDatabase() {
|
||||
void FillLEDsFromPaletteColors( uint8_t colorIndex) {
|
||||
uint8_t brightness = 255;
|
||||
|
||||
for( int i = 0; i < NUM_LEDS; ++i) {
|
||||
for( int i = 0; i < LED_NUM_LEDS; ++i) {
|
||||
leds[i] = ColorFromPalette( pal, colorIndex, brightness, LINEARBLEND);
|
||||
colorIndex += stepSegments;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user