Created
December 15, 2019 19:07
-
-
Save jfrmilner/bd9121798bb14ba7b23802981141f875 to your computer and use it in GitHub Desktop.
Arduino FastLED Drinks Coaster
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
/* | |
* FastLED Drinks Coaster | |
* Date: 12-2019 | |
* Auth: jfrmilner | |
*/ | |
#include "FastLED.h" | |
#define DATA_PIN 2 | |
#define LED_TYPE WS2812 | |
#define COLOR_ORDER GRB | |
#define NUM_LEDS 7 | |
CRGB leds[NUM_LEDS]; | |
#define FRAMES_PER_SECOND 8 | |
void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(128); } } | |
void setup() { | |
// tell FastLED about the LED strip configuration | |
FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); | |
} | |
void loop() { | |
static uint8_t hue = 0; | |
for(int i = 1; i < NUM_LEDS; i++) { | |
fadeall(); | |
fadeall(); | |
hue = hue +30; | |
leds[i] = CHSV(hue, 255, 255); | |
FastLED.delay(1000/FRAMES_PER_SECOND); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Demo