Skip to content

Instantly share code, notes, and snippets.

@jfrmilner
Created December 15, 2019 19:07
Show Gist options
  • Save jfrmilner/bd9121798bb14ba7b23802981141f875 to your computer and use it in GitHub Desktop.
Save jfrmilner/bd9121798bb14ba7b23802981141f875 to your computer and use it in GitHub Desktop.
Arduino FastLED Drinks Coaster
/*
* 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);
}
}
@jfrmilner
Copy link
Author

Demo
20191215_191124638_iOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment