Skip to content

Instantly share code, notes, and snippets.

@chemdoc77
Created October 30, 2018 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chemdoc77/e9f365d0dda1ad1dd3db2c21cd94c16a to your computer and use it in GitHub Desktop.
Save chemdoc77/e9f365d0dda1ad1dd3db2c21cd94c16a to your computer and use it in GitHub Desktop.
Some basic FastLED animations by Chemdoc77
//Basic FastLED Aminations by Chemdoc77
#include <FastLED.h>
#define DATA_PIN 6
#define LED_TYPE NEOPIXEL
#define NUM_LEDS 24
CRGB leds[NUM_LEDS];
int brightness = 100;
void setup() {
delay(2000);
FastLED.addLeds<LED_TYPE, DATA_PIN>(leds, NUM_LEDS);
FastLED.setDither(false);
FastLED.setCorrection(TypicalLEDStrip);
FastLED.setBrightness(brightness);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 1500);
set_max_power_indicator_LED(13);
fill_solid(leds, NUM_LEDS, CRGB::Black);
FastLED.show();
}
void loop() {
cd77_colorwipe_color_then_black(CRGB::Red, 50);
}
//==================== Functions ===============================
void cd77_colorwipe_color_then_black(CRGB color, uint16_t wait) {
for (uint16_t i = 0; i <NUM_LEDS; i++) {
leds[i] = color;
FastLED.delay(wait);
}
for (uint16_t i = 0; i <NUM_LEDS; i++) {
leds[i] = CRGB::Black;
FastLED.delay(wait);
}
}
void cd77_colorwipe(CRGB color, uint16_t wait) {
for (uint16_t i = 0; i <NUM_LEDS; i++) {
leds[i] = color;
FastLED.delay(wait);
}
}
void cd77_colorwipe_dot(CRGB color, uint16_t wait) {
for (uint16_t i = 0; i <NUM_LEDS; i++) {
leds[i] = color;
FastLED.delay(wait);
leds[i] = CRGB::Black;
FastLED.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment