Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*his sketch is still in beta. The timing of he color changes must be set as well as the length of the daily cycle.*/
- #include <FastLED.h>
- #define dataPin 5
- #define Color_Order GRB
- #define CHIPSET WS2812B
- #define NUM_LEDS 15
- #define BRIGHTNESS 200
- CRGB leds[NUM_LEDS];
- DEFINE_GRADIENT_PALETTE(sunrise_gp) {
- 0, 0, 0, 0,
- 18, 98, 0, 0,
- 56, 161, 83, 0,
- 115, 212, 202, 0,
- 179, 255, 253, 213,
- 255, 255, 255, 255
- };
- CRGBPalette256 sunPal = sunrise_gp;
- uint8_t paletteIndex = 0;
- bool countUp = true;
- void setup() {
- FastLED.addLeds<CHIPSET, dataPin, Color_Order>(leds, NUM_LEDS);
- }
- void loop() {
- EVERY_N_MILLISECONDS(100) {
- for (int i = 0; i < NUM_LEDS; i++) {
- leds[i] = ColorFromPalette(sunPal, paletteIndex);
- }
- FastLED.show();
- if (countUp) {
- paletteIndex += 1;
- if (paletteIndex == 255) {
- countUp = false;
- }
- } else {
- paletteIndex -= 1;
- if (paletteIndex == 0) {
- countUp = true;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment