#include <FastLED.h>
#define DATA_PIN 2
#define NUM_LEDS 50
#define MAX_BRIGHTNESS 255
#define BRIGHTNESS 255
#define LED_TYPE WS2811
CRGB leds[NUM_LEDS];
void setup() {
Serial.begin(9600);
FastLED.addLeds<LED_TYPE, DATA_PIN, RGB>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
}
//Perimeter
int entireP[26] ={23,22,21,11,10,4,3,1,2,6,7,15,16,27,28,40,41,47,48,49,43,44,36,35,31,30};
//at 23 (start up right) and 27 (start left on left perimeter) are points of change
//Heartcontents
// right half from 1 to 27
//left half from 23 to 49
int full[49]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49}
CRGB black = CRGB::Black;
CRGB red = CRGB::Red;
CRGB pink = CRGB::Pink;
CRGB blue = CRGB::LightBlue;
CRGB yellow = CRGB::LightYellow;
CRGB white = CRGB::White;
void loop() {
// consec_set();
full_flash();
onebyone_add();
multidown_set();
fade_three();
onecolor_flash();
colorhue();
}
// flashes every led in a set one color
void full_flash(int sec[], int from, int to, CRGB color, int dly) {
for ( int x = 0; int x = from; x <= to; x++) {
leds[sec[x+1]]=color;
}
FastLED.delay(dly);
}
//loops through each light in an array one by one
void onebyone_add(int sec[], int from, int to){
for ( int x = 0; int x = from; x <= to; x++ ) {
leds[x] = CRGB::White;
}
FastLED.show();
}
//multiple colors down a set
void multidown_set(int sec[], CRGB color1, CRGB color2, int dly) {
for (int x = 0; x < sizeof(sec[x]); x++) {
leds[sec[x]] = color1;
FastLED.delay(dly);
leds[sec[x+1]] = color2;
}
}
//fullheart fades trhough
void fade_three(int sec[], int from, int to, color1,color2,color3) {
int hue[3]= {color1,color2,color3};
for (int c = 0; c < 3; c++) {
for (int v = 255; v >= 5; v=v-5) {
for (int x = 0; int x = from; x <= to; x++) {
leds[sec[x]] = CHSV(hue[c], 255, v);
}
FastLED.delay(30);
}
}
}
//lights up one color
void one_colorflash() {
int x = NUM_LEDS;
while(x > 0){
leds[x]=CRGB::Black;
x = x-1;
}
for ( int x = 0; x < NUM_LEDS; x++) {
leds[x]= CRGB::Green;
leds[x-1]=CRGB::Black;
FastLED.delay(200);
}
}
//fades trhough each color for all leds
void colorhue() {
int h = 255;
int s = 255;
int v = 255;
while (h>0){
for ( int x = 0; x < NUM_LEDS; x++) {
leds[x] = CHSV(h,s,v);
}
FastLED.delay(30);
h=h-1;
}
}
//within set, consecutive color
// void consec_set(int sec[], int from, int to, color1, color2, color3){
// for (int k = 0; k < 3; k++) {
// CRGB myColor;
// switch(k) {
// case 0:
// myColor = c;
// break;
// case 1:
// myColor = blue;
// break;
// case 2:
// myColor = yellow;
// break;
// }
// int x = NUM_LEDS;
// while(x > 0){
// leds[x]=CRGB::Black;
// x = x-1;
// }
// for ( int x = 0; x < sizeof(sec[]); x++) {
// leds[x]= myColor;
// leds[x-1]=CRGB::Black;
// FastLED.delay(200);
// }
// }
// }