Created
October 30, 2018 01:13
-
-
Save chemdoc77/e9f365d0dda1ad1dd3db2c21cd94c16a to your computer and use it in GitHub Desktop.
Some basic FastLED animations by Chemdoc77
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
//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