#include <FastLED.h>
#define NUM_LEDS 12
#define DATA_PIN 6
#define LED_TYPE NEOPIXEL
DEFINE_GRADIENT_PALETTE(gradientPalette)
{
0, 0, 0, 0, // Start
124, 48, 48, 48,
128, 255, 255, 255, // Centre
132, 48, 48, 48,
255, 0, 0, 0 // End
};
CRGBPalette16 palette = gradientPalette;
CRGB leds[NUM_LEDS]; // Array that holds each LED's values to be displayed
byte brightness = 192; // 0 - 255
byte secondSpeed = 3; // Set for seconds
//int hourSpeed = 2345; // Set for hours
uint8_t paletteIndex = 0;
void setup()
{
FastLED.addLeds<LED_TYPE, DATA_PIN>(leds, NUM_LEDS);
FastLED.setBrightness(brightness);
FastLED.clear();
}
void loop()
{
seconds();
//hours();
FastLED.show();
}
void seconds()
{
fill_palette(leds, NUM_LEDS, paletteIndex, 255 / NUM_LEDS, palette, 255, LINEARBLEND);
EVERY_N_MILLISECONDS(secondSpeed)
{
paletteIndex++;
}
}
void hours()
{
// Code for the hours LED
}