Untitled diff

Created Diff never expires
#include <Adafruit_NeoPixel.h>
#include <Adafruit_NeoPixel.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <PubSubClient.h>
#define FASTLED_INTERRUPT_RETRY_COUNT 0
#define FASTLED_INTERRUPT_RETRY_COUNT 0
#include <FastLED.h>
#include <FastLED.h>
#include <ArduinoOTA.h>
#include <ArduinoOTA.h>
#include <ESP8266mDNS.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <WiFiUdp.h>
/************ WIFI and MQTT INFORMATION (CHANGE THESE FOR YOUR SETUP) ******************/
/************ WIFI and MQTT INFORMATION (CHANGE THESE FOR YOUR SETUP) ******************/
#define wifi_ssid "**" //enter your WIFI SSID
#define wifi_ssid "**" //enter your WIFI SSID
#define wifi_password "**" //enter your WIFI Password
#define wifi_password "**" //enter your WIFI Password


/**************************** FOR OTA **************************************************/
/**************************** FOR OTA **************************************************/
#define SENSORNAME "Holiday LED Arduino" //change this to whatever you want to call your device
#define SENSORNAME "Holiday LED Arduino" //change this to whatever you want to call your device
#define OTApassword "**" //the password you will need to enter to upload remotely via the ArduinoIDE
#define OTApassword "**" //the password you will need to enter to upload remotely via the ArduinoIDE
int OTAport = 8266;
int OTAport = 8266;


#define mqtt_server "192.168.145.245" // Enter your MQTT server adderss or IP. I use my DuckDNS adddress (yourname.duckdns.org) in this field
#define mqtt_server "192.168.145.245" // Enter your MQTT server adderss or IP. I use my DuckDNS adddress (yourname.duckdns.org) in this field
#define mqtt_user "**" //enter your MQTT username
#define mqtt_user "**" //enter your MQTT username
#define mqtt_password "**" //enter your password
#define mqtt_password "**" //enter your password


/************ FastLED Defintions ******************/
/************ FastLED Defintions ******************/


#define DATA_PIN D4 //on the NodeMCU 1.0, FastLED will default to the D5 pin after throwing an error during compiling. Leave as is.
#define DATA_PIN D4 //on the NodeMCU 1.0, FastLED will default to the D5 pin after throwing an error during compiling. Leave as is.
#define LED_TYPE WS2812B //change to match your LED type
#define LED_TYPE WS2812B //change to match your LED type
#define COLOR_ORDER GRB //change to match your LED configuration, ws2812 are GRB, 2811 are RGB
#define COLOR_ORDER GRB //change to match your LED configuration, ws2812 are GRB, 2811 are RGB
#define NUM_LEDS 223 //change to match your setup, for multiple runs of LEDs use the number of the run with the most LEDs.
#define NUM_LEDS 223 //change to match your setup, for multiple runs of LEDs use the number of the run with the most LEDs.


///////////////DrZzs Palettes for custom BPM effects//////////////////////////
///////////////DrZzs Palettes for custom BPM effects//////////////////////////
///////////////Add any custom palettes here//////////////////////////////////
///////////////Add any custom palettes here//////////////////////////////////


//Thanksgiving colors
//Thanksgiving colors
// Gradient palette "bhw2_thanks_gp", originally from
// Gradient palette "bhw2_thanks_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw2/tn/bhw2_thanks.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw2/tn/bhw2_thanks.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 36 bytes of program space.
// Size: 36 bytes of program space.


DEFINE_GRADIENT_PALETTE( bhw2_thanks_gp ) {
DEFINE_GRADIENT_PALETTE( bhw2_thanks_gp ) {
0, 9, 5, 1,
0, 9, 5, 1,
48, 25, 9, 1,
48, 25, 9, 1,
76, 137, 27, 1,
76, 137, 27, 1,
96, 98, 42, 1,
96, 98, 42, 1,
124, 144, 79, 1,
124, 144, 79, 1,
153, 98, 42, 1,
153, 98, 42, 1,
178, 137, 27, 1,
178, 137, 27, 1,
211, 23, 9, 1,
211, 23, 9, 1,
255, 9, 5, 1};
255, 9, 5, 1};


//Red/Pink colors
//Red/Pink colors
// Gradient palette "bhw2_redrosey_gp", originally from
// Gradient palette "bhw2_redrosey_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw2/tn/bhw2_redrosey.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw2/tn/bhw2_redrosey.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 32 bytes of program space.
// Size: 32 bytes of program space.


DEFINE_GRADIENT_PALETTE( bhw2_redrosey_gp ) {
DEFINE_GRADIENT_PALETTE( bhw2_redrosey_gp ) {
0, 103, 1, 10,
0, 103, 1, 10,
33, 109, 1, 12,
33, 109, 1, 12,
76, 159, 5, 48,
76, 159, 5, 48,
119, 175, 55,103,
119, 175, 55,103,
127, 175, 55,103,
127, 175, 55,103,
178, 159, 5, 48,
178, 159, 5, 48,
221, 109, 1, 12,
221, 109, 1, 12,
255, 103, 1, 10};
255, 103, 1, 10};


//Blue to Red - has light blue white and pink
//Blue to Red - has light blue white and pink
// Gradient palette "bluered_gp", originally from
// Gradient palette "bluered_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/h5/tn/bluered.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/h5/tn/bluered.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 12 bytes of program space.
// Size: 12 bytes of program space.


DEFINE_GRADIENT_PALETTE( bluered_gp ) {
DEFINE_GRADIENT_PALETTE( bluered_gp ) {
0, 0, 0,255,
0, 0, 0,255,
127, 255,255,255,
127, 255,255,255,
255, 255, 0, 0};
255, 255, 0, 0};


//Green and Red
//Green and Red
// Gradient palette "bhw2_xmas_gp", originally from
// Gradient palette "bhw2_xmas_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw2/tn/bhw2_xmas.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw2/tn/bhw2_xmas.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 48 bytes of program space.
// Size: 48 bytes of program space.


DEFINE_GRADIENT_PALETTE( bhw2_xmas_gp ) {
DEFINE_GRADIENT_PALETTE( bhw2_xmas_gp ) {
0, 0, 12, 0,
0, 0, 12, 0,
40, 0, 55, 0,
40, 0, 55, 0,
66, 1,117, 2,
66, 1,117, 2,
77, 1, 84, 1,
77, 1, 84, 1,
81, 0, 55, 0,
81, 0, 55, 0,
119, 0, 12, 0,
119, 0, 12, 0,
153, 42, 0, 0,
153, 42, 0, 0,
181, 121, 0, 0,
181, 121, 0, 0,
204, 255, 12, 8,
204, 255, 12, 8,
224, 121, 0, 0,
224, 121, 0, 0,
244, 42, 0, 0,
244, 42, 0, 0,
255, 42, 0, 0};
255, 42, 0, 0};


//Purple orange yellow colors
//Purple orange yellow colors
// Gradient palette "bhw2_xc_gp", originally from
// Gradient palette "bhw2_xc_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw2/tn/bhw2_xc.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw2/tn/bhw2_xc.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 28 bytes of program space.
// Size: 28 bytes of program space.


DEFINE_GRADIENT_PALETTE( bhw2_xc_gp ) {
DEFINE_GRADIENT_PALETTE( bhw2_xc_gp ) {
0, 4, 2, 9,
0, 4, 2, 9,
58, 16, 0, 47,
58, 16, 0, 47,
122, 24, 0, 16,
122, 24, 0, 16,
158, 144, 9, 1,
158, 144, 9, 1,
183, 179, 45, 1,
183, 179, 45, 1,
219, 220,114, 2,
219, 220,114, 2,
255, 234,237, 1};
255, 234,237, 1};


//Yellow orange purple blue
//Yellow orange purple blue
// Gradient palette "bhw1_04_gp", originally from
// Gradient palette "bhw1_04_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw1/tn/bhw1_04.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw1/tn/bhw1_04.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 20 bytes of program space.
// Size: 20 bytes of program space.


DEFINE_GRADIENT_PALETTE( bhw1_04_gp ) {
DEFINE_GRADIENT_PALETTE( bhw1_04_gp ) {
0, 229,227, 1,
0, 229,227, 1,
15, 227,101, 3,
15, 227,101, 3,
142, 40, 1, 80,
142, 40, 1, 80,
198, 17, 1, 79,
198, 17, 1, 79,
255, 0, 0, 45};
255, 0, 0, 45};


//blue and yellow
//blue and yellow
// Gradient palette "bhw4_051_gp", originally from
// Gradient palette "bhw4_051_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw4/tn/bhw4_051.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw4/tn/bhw4_051.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 36 bytes of program space.
// Size: 36 bytes of program space.


//More thanksgiving colors
//More thanksgiving colors
// Gradient palette "fs2006_gp", originally from
// Gradient palette "fs2006_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/cl/tn/fs2006.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/cl/tn/fs2006.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 56 bytes of program space.
// Size: 56 bytes of program space.


DEFINE_GRADIENT_PALETTE( fs2006_gp ) {
DEFINE_GRADIENT_PALETTE( fs2006_gp ) {
0, 0, 49, 5,
0, 0, 49, 5,
34, 0, 49, 5,
34, 0, 49, 5,
34, 79,168, 66,
34, 79,168, 66,
62, 79,168, 66,
62, 79,168, 66,
62, 252,168, 92,
62, 252,168, 92,
103, 252,168, 92,
103, 252,168, 92,
103, 234, 81, 29,
103, 234, 81, 29,
143, 234, 81, 29,
143, 234, 81, 29,
143, 222, 30, 1,
143, 222, 30, 1,
184, 222, 30, 1,
184, 222, 30, 1,
184, 90, 13, 1,
184, 90, 13, 1,
238, 90, 13, 1,
238, 90, 13, 1,
238, 210, 1, 1,
238, 210, 1, 1,
255, 210, 1, 1};
255, 210, 1, 1};




DEFINE_GRADIENT_PALETTE( bhw4_051_gp ) {
DEFINE_GRADIENT_PALETTE( bhw4_051_gp ) {
0, 1, 1, 4,
0, 1, 1, 4,
28, 16, 24, 77,
28, 16, 24, 77,
66, 35, 87,160,
66, 35, 87,160,
101, 125,187,205,
101, 125,187,205,
127, 255,233, 13,
127, 255,233, 13,
145, 125,187,205,
145, 125,187,205,
193, 28, 70,144,
193, 28, 70,144,
224, 14, 19, 62,
224, 14, 19, 62,
255, 1, 1, 4};
255, 1, 1, 4};


//dark blue light blue colors
//dark blue light blue colors
// Gradient palette "blue_g2_5_gp", originally from
// Gradient palette "blue_g2_5_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/go2/webtwo/tn/blue-g2-5.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/go2/webtwo/tn/blue-g2-5.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 16 bytes of program space.
// Size: 16 bytes of program space.


DEFINE_GRADIENT_PALETTE( blue_g2_5_gp ) {
DEFINE_GRADIENT_PALETTE( blue_g2_5_gp ) {
0, 2, 6, 63,
0, 2, 6, 63,
127, 2, 9, 67,
127, 2, 9, 67,
255, 255, 255, 115,
255, 255, 255, 115,
255, 255, 255, 0};
255, 255, 255, 0};


//Blue White Red colors
//Blue White Red colors
// Gradient palette "bhw3_41_gp", originally from
// Gradient palette "bhw3_41_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw3/tn/bhw3_41.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw3/tn/bhw3_41.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 36 bytes of program space.
// Size: 36 bytes of program space.


DEFINE_GRADIENT_PALETTE( bhw3_41_gp ) {
DEFINE_GRADIENT_PALETTE( bhw3_41_gp ) {
0, 0, 0, 45,
0, 0, 0, 45,
71, 7, 12,255,
71, 7, 12,255,
76, 75, 91,255,
76, 75, 91,255,
76, 255,255,255,
76, 255,255,255,
81, 255,255,255,
81, 255,255,255,
178, 255,255,255,
178, 255,255,255,
179, 255, 55, 45,
179, 255, 55, 45,
196, 255, 0, 0,
196, 255, 0, 0,
255, 42, 0, 0};
255, 42, 0, 0};


DEFINE_GRADIENT_PALETTE( test_gp ) {
DEFINE_GRADIENT_PALETTE( test_gp ) {
0, 255, 0, 0, // Red
0, 255, 0, 0, // Red
// 32, 171, 85, 0, // Orange
// 32, 171, 85, 0, // Orange
// 64, 171,171, 0, // Yellow
// 64, 171,171, 0, // Yellow
// 96, 0,255, 0, // Green
// 96, 0,255, 0, // Green
//128, 0,171, 85, // Aqua
//128, 0,171, 85, // Aqua
160, 0, 0,255, // Blue
160, 0, 0,255, // Blue
//192, 85, 0,171, // Purple
//192, 85, 0,171, // Purple
//224, 171, 0, 85, // Pink
//224, 171, 0, 85, // Pink
//255, 255, 0, 0};// and back to Red
//255, 255, 0, 0};// and back to Red
};
};


//Green colors
//Green colors
// Gradient palette "bhw2_greenman_gp", originally from
// Gradient palette "bhw2_greenman_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw2/tn/bhw2_greenman.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/bhw/bhw2/tn/bhw2_greenman.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 12 bytes of program space.
// Size: 12 bytes of program space.


DEFINE_GRADIENT_PALETTE( bhw2_greenman_gp ) {
DEFINE_GRADIENT_PALETTE( bhw2_greenman_gp ) {
0, 1, 22, 1,
0, 1, 22, 1,
130, 1,168, 2,
130, 1,168, 2,
255, 1, 22, 1};
255, 1, 22, 1};


//blue and yellow
//blue and yellow
// Gradient palette "Pills_3_gp", originally from
// Gradient palette "Pills_3_gp", originally from
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ds/icons/tn/Pills-3.png.index.html
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ds/icons/tn/Pills-3.png.index.html
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// converted for FastLED with gammas (2.6, 2.2, 2.5)
// Size: 12 bytes of program space.
// Size: 12 bytes of program space.


DEFINE_GRADIENT_PALETTE( Pills_3_gp ) {
DEFINE_GRADIENT_PALETTE( Pills_3_gp ) {
0, 4, 12,122,
0, 4, 12,122,
127, 55, 58, 50,
127, 55, 58, 50,
255, 192,147, 11};
255, 192,147, 11};


/****************************** MQTT TOPICS (change these topics as you wish) ***************************************/
/****************************** MQTT TOPICS (change these topics as you wish) ***************************************/


#define colorstatuspub "bruh/mqttstrip/colorstatus"
#define colorstatuspub "bruh/mqttstrip/colorstatus"
#define setcolorsub "bruh/mqttstrip/setcolor"
#define setcolorsub "bruh/mqttstrip/setcolor"
#define setpowersub "bruh/mqttstrip/setpower"
#define setpowersub "bruh/mqttstrip/setpower"
#define seteffectsub "bruh/mqttstrip/seteffect"
#define seteffectsub "bruh/mqttstrip/seteffect"
#define setbrightness "bruh/mqttstrip/setbrightness"
#define setbrightness "bruh/mqttstrip/setbrightness"


#define setcolorpub "bruh/mqttstrip/setcolorpub"
#define setcolorpub "bruh/mqttstrip/setcolorpub"
#define setpowerpub "bruh/mqttstrip/setpowerpub"
#define setpowerpub "bruh/mqttstrip/setpowerpub"
#define seteffectpub "bruh/mqttstrip/seteffectpub"
#define seteffectpub "bruh/mqttstrip/seteffectpub"
#define setbrightnesspub "bruh/mqttstrip/setbrightnesspub"
#define setbrightnesspub "bruh/mqttstrip/setbrightnesspub"
#define setanimationspeed "bruh/mqttstrip/setanimationspeed"
#define setanimationspeed "bruh/mqttstrip/setanimationspeed"


/*************************** EFFECT CONTROL VARIABLES AND INITIALIZATIONS ************************************/
/*************************** EFFECT CONTROL VARIABLES AND INITIALIZATIONS ************************************/


#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000)
#warning "Requires FastLED 3.1 or later; check github for latest code."
#warning "Requires FastLED 3.1 or later; check github for latest code."
#endif
#endif


String setColor ="0,0,150";
String setColor ="0,0,150";
String setPower;
String setPower;
String setEffect = "Solid";
String setEffect = "Solid";
String setBrightness = "150";
String setBrightness = "150";
int brightness = 150;
int brightness = 150;
String setAnimationSpeed;
String setAnimationSpeed;
int animationspeed = 240;
int animationspeed = 240;
String setColorTemp;
String setColorTemp;
int Rcolor = 0;
int Rcolor = 0;
int Gcolor = 0;
int Gcolor = 0;
int Bcolor = 0;
int Bcolor = 0;
CRGB leds[NUM_LEDS];
CRGB leds[NUM_LEDS];


TBlendType currentBlending;
TBlendType currentBlending;


/****************FOR CANDY CANE-like desings***************/
/****************FOR CANDY CANE-like desings***************/
CRGBPalette16 currentPalettestriped; //for Candy Cane
CRGBPalette16 currentPalettestriped; //for Candy Cane
CRGBPalette16 RGWPalettestriped; //for Red Green White
CRGBPalette16 RGWPalettestriped; //for Red Green White
CRGBPalette16 RGPalettestriped; //for Red Green Glitter
CRGBPalette16 RGPalettestriped; //for Red Green Glitter
CRGBPalette16 hailPalettestriped; //for Hail
CRGBPalette16 hailPalettestriped; //for Hail
CRGBPalette16 ThxPalettestriped; //for Thanksgiving
CRGBPalette16 ThxPalettestriped; //for Thanksgiving
CRGBPalette16 HalloweenPalettestriped; //for Halloween Purple and Orange EFFECT
CRGBPalette16 HalloweenPalettestriped; //for Halloween Purple and Orange EFFECT
CRGBPalette16 Halloween2Palettestriped; //for Halloween Orange and Green EFFECT
CRGBPalette16 Halloween2Palettestriped; //for Halloween Orange and Green EFFECT
CRGBPalette16 Halloween3Palettestriped; //for Halloween Purple and Green EFFECT
CRGBPalette16 Halloween3Palettestriped; //for Halloween Purple and Green EFFECT
CRGBPalette16 HalloweenTriPalettestriped; //for 3 color Halloween Purple, Orange and Green
CRGBPalette16 HalloweenTriPalettestriped; //for 3 color Halloween Purple, Orange and Green
CRGBPalette16 PurpleGreenPalettestriped; //for Halloween Purple and Green
CRGBPalette16 PurpleGreenPalettestriped; //for Halloween Purple and Green
CRGBPalette16 OrangeGreenPalettestriped; //for Halloween Orange and Green
CRGBPalette16 OrangeGreenPalettestriped; //for Halloween Orange and Green
CRGBPalette16 OrangePurplePalettestriped; //for Halloween Orange and Green
CRGBPalette16 OrangePurplePalettestriped; //for Halloween Orange and Green
CRGBPalette16 CandyCornPalettestriped; //for Candy Corn
CRGBPalette16 CandyCornPalettestriped; //for Candy Corn
CRGBPalette16 HJPalettestriped; //for Holly Jolly
CRGBPalette16 HJPalettestriped; //for Holly Jolly
CRGBPalette16 IndPalettestriped; //for Independence
CRGBPalette16 IndPalettestriped; //for Independence
CRGBPalette16 gPal; //for fire
CRGBPalette16 gPal; //for fire
extern const TProgmemPalette16 myC9Palette PROGMEM;
extern const TProgmemPalette16 myC9Palette PROGMEM;


/****************FOR NOISE - I'm using this one for Easter***************/
/****************FOR NOISE - I'm using this one for Easter***************/
static uint16_t dist; // A random number for our noise generator.
static uint16_t dist; // A random number for our noise generator.
uint16_t scale = 30; // Wouldn't recommend changing this on the fly, or the animation will be really blocky.
uint16_t scale = 30; // Wouldn't recommend changing this on the fly, or the animation will be really blocky.
uint8_t maxChanges = 48; // Value for blending between palettes.
uint8_t maxChanges = 48; // Value for blending between palettes.
CRGBPalette16 targetPalette(OceanColors_p);
CRGBPalette16 targetPalette(OceanColors_p);
CRGBPalette16 currentPalette(CRGB::Black);
CRGBPalette16 currentPalette(CRGB::Black);
uint8_t colorIndex;
uint8_t colorIndex;


/*****************For TWINKLE********/
/*****************For TWINKLE********/
#define DENSITY 80
#define DENSITY 80
int twinklecounter = 0;
int twinklecounter = 0;


/*********FOR RIPPLE***********/
/*********FOR RIPPLE***********/
uint8_t colour; // Ripple colour is randomized.
uint8_t colour; // Ripple colour is randomized.
int center = 0; // Center of the current ripple.
int center = 0; // Center of the current ripple.
int step = -1; // -1 is the initializing step.
int step = -1; // -1 is the initializing step.
uint8_t myfade = 255; // Starting brightness.
uint8_t myfade = 255; // Starting brightness.
#define maxsteps 16 // Case statement wouldn't allow a variable.
#define maxsteps 16 // Case statement wouldn't allow a variable.
uint8_t bgcol = 0; // Background colour rotates.
uint8_t bgcol = 0; // Background colour rotates.
int thisdelay = 20; // Standard delay value.
int thisdelay = 20; // Standard delay value.


/**************FOR RAINBOW***********/
/**************FOR RAINBOW***********/
uint8_t thishue = 0; // Starting hue value.
uint8_t thishue = 0; // Starting hue value.
uint8_t deltahue = 10;
uint8_t deltahue = 10;


/**************FOR DOTS**************/
/**************FOR DOTS**************/
uint8_t count = 0; // Count up to 255 and then reverts to 0
uint8_t count = 0; // Count up to 255 and then reverts to 0
uint8_t fadeval = 224; // Trail behind the LED's. Lower => faster fade.
uint8_t fadeval = 224; // Trail behind the LED's. Lower => faster fade.
uint8_t bpm = 30;
uint8_t bpm = 30;


/**************FOR LIGHTNING**************/
/**************FOR LIGHTNING**************/
uint8_t frequency = 75; // controls the interval between strikes
uint8_t frequency = 75; // controls the interval between strikes
uint8_t flashes = 8; //the upper limit of flashes per strike
uint8_t flashes = 8; //the upper limit of flashes per strike
unsigned int dimmer = 1;
unsigned int dimmer = 1;
uint8_t ledstart; // Starting location of a flash
uint8_t ledstart; // Starting location of a flash
uint8_t ledlen;
uint8_t ledlen;
int lightningcounter = 0;
int lightningcounter = 0;


/**************FOR STROBE**************/
uint8_t strobeIntervalMs = 50; // controls the interval between strobe flashes
CRGB strobeColor = CRGB::White; // the "on" color of the strobe

/********FOR FUNKBOX EFFECTS**********/
/********FOR FUNKBOX EFFECTS**********/
int idex = 0; //-LED INDEX (0 to NUM_LEDS-1
int idex = 0; //-LED INDEX (0 to NUM_LEDS-1
int TOP_INDEX = int(NUM_LEDS / 2);
int TOP_INDEX = int(NUM_LEDS / 2);
int thissat = 255; //-FX LOOPS DELAY VAR
int thissat = 255; //-FX LOOPS DELAY VAR


//////////////////add thishue__ for Police All custom effects here/////////////////////////////////////////////////////////
//////////////////add thishue__ for Police All custom effects here/////////////////////////////////////////////////////////
/////////////////use hsv Hue number for one color, for second color change "thishue__ + __" in the setEffect section//////
/////////////////use hsv Hue number for one color, for second color change "thishue__ + __" in the setEffect section//////


uint8_t thishuepolice = 0;
uint8_t thishuepolice = 0;
uint8_t thishuehail = 64;
uint8_t thishuehail = 64;
uint8_t thishueLovey = 0;
uint8_t thishueLovey = 0;
uint8_t thishueHalloween = 28;
uint8_t thishueHalloween = 28;
uint8_t thishueHalloween2 = 28;
uint8_t thishueHalloween2 = 28;
uint8_t thishueHalloween3 = 96;
uint8_t thishueHalloween3 = 96;
int antipodal_index(int i) {
int antipodal_index(int i) {
int iN = i + TOP_INDEX;
int iN = i + TOP_INDEX;
if (i >= TOP_INDEX) {
if (i >= TOP_INDEX) {
iN = ( i + TOP_INDEX ) % NUM_LEDS;
iN = ( i + TOP_INDEX ) % NUM_LEDS;
}
}
return iN;
return iN;
}
}


/********FIRE**********/
/********FIRE**********/
#define COOLING 55
#define COOLING 55
#define SPARKING 120
#define SPARKING 120
bool gReverseDirection = false;
bool gReverseDirection = false;


/********BPM**********/
/********BPM**********/
uint8_t gHue = 0;
uint8_t gHue = 0;
char message_buff[100];
char message_buff[100];




WiFiClient espArch;
WiFiClient espArch;
PubSubClient client(espArch);
PubSubClient client(espArch);


////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////


void setup() {
void setup() {
WiFi.setSleepMode(WIFI_NONE_SLEEP);
WiFi.setSleepMode(WIFI_NONE_SLEEP);
Serial.begin(115200);
Serial.begin(115200);


FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setMaxPowerInVoltsAndMilliamps(12, 10000); //experimental for power management. Feel free to try in your own setup.
FastLED.setMaxPowerInVoltsAndMilliamps(12, 10000); //experimental for power management. Feel free to try in your own setup.
FastLED.setBrightness(brightness);
FastLED.setBrightness(brightness);


setupStripedPalette( CRGB::Red, CRGB::Red, CRGB::White, CRGB::White); //for CANDY CANE
setupStripedPalette( CRGB::Red, CRGB::Red, CRGB::White, CRGB::White); //for CANDY CANE
setupRGWPalette( CRGB::Red, CRGB::White, CRGB::Green, CRGB::White); //for Red Green White
setupRGWPalette( CRGB::Red, CRGB::White, CRGB::Green, CRGB::White); //for Red Green White
setupRGPalette( CRGB::Red, CRGB::Green, CRGB::Red, CRGB::Green); //for Red Green
setupRGPalette( CRGB::Red, CRGB::Green, CRGB::Red, CRGB::Green); //for Red Green
setupThxPalette( CRGB::OrangeRed, CRGB::Olive, CRGB::Maroon, CRGB::Maroon); //for Thanksgiving
setupThxPalette( CRGB::OrangeRed, CRGB::Olive, CRGB::Maroon, CRGB::Maroon); //for Thanksgiving
setupHailPalette( CRGB::Blue, CRGB::Blue, CRGB::Yellow, CRGB::Yellow); //for HAIL
setupHailPalette( CRGB::Blue, CRGB::Blue, CRGB::Yellow, CRGB::Yellow); //for HAIL
setupHalloweenTriPalette( CRGB(255,95,0), CRGB(0,255,0), CRGB(115,0,235), CRGB::Black); //for Halloween Orange Green Purple
setupHalloweenTriPalette( CRGB(255,95,0), CRGB(0,255,0), CRGB(115,0,235), CRGB::Black); //for Halloween Orange Green Purple
setupOrangeGreenPalette( CRGB(255,95,0), CRGB(0,255,0), CRGB::Black, CRGB(0,255,0)); //for Halloween Orange & Green
setupOrangeGreenPalette( CRGB(255,95,0), CRGB(0,255,0), CRGB::Black, CRGB(0,255,0)); //for Halloween Orange & Green
setupPurpleGreenPalette( CRGB(115,0,235), CRGB(0,255,0), CRGB::Black, CRGB(0,255,0)); //for Halloween Purple & Green
setupPurpleGreenPalette( CRGB(115,0,235), CRGB(0,255,0), CRGB::Black, CRGB(0,255,0)); //for Halloween Purple & Green
setupOrangePurplePalette( CRGB(255,95,0), CRGB(115,0,235), CRGB::Black, CRGB(255,95,0)); //for Halloween Orange & Purple
setupOrangePurplePalette( CRGB(255,95,0), CRGB(115,0,235), CRGB::Black, CRGB(255,95,0)); //for Halloween Orange & Purple
setupCandyCornPalette( CRGB(255,95,0), CRGB(240,240,0), CRGB(255,255,255), CRGB::Black); //for CandyCane Orange Yellow White
setupCandyCornPalette( CRGB(255,95,0), CRGB(240,240,0), CRGB(255,255,255), CRGB::Black); //for CandyCane Orange Yellow White
setupHJPalette( CRGB::Red, CRGB::Red, CRGB::Green, CRGB::Green); //for Holly Jolly
setupHJPalette( CRGB::Red, CRGB::Red, CRGB::Green, CRGB::Green); //for Holly Jolly
setupIndPalette( CRGB::Red, CRGB::White, CRGB::Blue, CRGB::MediumBlue); //for Independence
setupIndPalette( CRGB::Red, CRGB::White, CRGB::Blue, CRGB::MediumBlue); //for Independence


/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
gPal = HeatColors_p; //for FIRE
gPal = HeatColors_p; //for FIRE


fill_solid(leds, NUM_LEDS, CRGB(255, 0, 0)); //Startup LED Lights
fill_solid(leds, NUM_LEDS, CRGB(255, 0, 0)); //Startup LED Lights
FastLED.show();
FastLED.show();


setup_wifi();
setup_wifi();


client.setServer(mqtt_server, 1883); //CHANGE PORT HERE IF NEEDED
client.setServer(mqtt_server, 1883); //CHANGE PORT HERE IF NEEDED
client.setCallback(callback);
client.setCallback(callback);


//OTA SETUP
//OTA SETUP
ArduinoOTA.setPort(OTAport);
ArduinoOTA.setPort(OTAport);
// Hostname defaults to esp8266-[ChipID]
// Hostname defaults to esp8266-[ChipID]
ArduinoOTA.setHostname(SENSORNAME);
ArduinoOTA.setHostname(SENSORNAME);


// No authentication by default
// No authentication by default
ArduinoOTA.setPassword((const char *)OTApassword);
ArduinoOTA.setPassword((const char *)OTApassword);


ArduinoOTA.onStart([]() {
ArduinoOTA.onStart([]() {
Serial.println("Starting");
Serial.println("Starting");
});
});
ArduinoOTA.onEnd([]() {
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
Serial.println("\nEnd");
});
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
});
ArduinoOTA.onError([](ota_error_t error) {
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
});
ArduinoOTA.begin();
ArduinoOTA.begin();


Serial.println("Ready");
Serial.println("Ready");
Serial.print("IP Address: ");
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
Serial.println(WiFi.localIP());
}
}




void setup_wifi() {
void setup_wifi() {


delay(10);
delay(10);
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.print("Connecting to ");
Serial.println(wifi_ssid);
Serial.println(wifi_ssid);


WiFi.mode(WIFI_STA);
WiFi.mode(WIFI_STA);
WiFi.begin(wifi_ssid, wifi_password);
WiFi.begin(wifi_ssid, wifi_password);


while (WiFi.status() != WL_CONNECTED) {
while (WiFi.status() != WL_CONNECTED) {
delay(500);
delay(500);
Serial.print(".");
Serial.print(".");
}
}


Serial.println("");
Serial.println("");
Serial.println("WiFi connected");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
Serial.println(WiFi.localIP());
}
}


void callback(char* topic, byte* payload, unsigned int length) {
void callback(char* topic, byte* payload, unsigned int length) {
int i = 0;
int i = 0;


if (String(topic) == setpowersub) {
if (String(topic) == setpowersub) {
for (i = 0; i < length; i++) {
for (i = 0; i < length; i++) {
message_buff[i] = payload[i];
message_buff[i] = payload[i];
}
}
message_buff[i] = '\0';
message_buff[i] = '\0';
setPower = String(message_buff);
setPower = String(message_buff);
Serial.println("Set Power: " + setPower);
Serial.println("Set Power: " + setPower);
if (setPower == "OFF") {
if (setPower == "OFF") {
client.publish(setpowerpub, "OFF");
client.publish(setpowerpub, "OFF");
}
}


if (setPower == "ON") {
if (setPower == "ON") {
client.publish(setpowerpub, "ON");
client.publish(setpowerpub, "ON");
}
}
}
}




if (String(topic) == seteffectsub) {
if (String(topic) == seteffectsub) {
for (i = 0; i < length; i++) {
for (i = 0; i < length; i++) {
message_buff[i] = payload[i];
message_buff[i] = payload[i];
}
}
message_buff[i] = '\0';
message_buff[i] = '\0';
setEffect = String(message_buff);
setEffect = String(message_buff);
Serial.println("Set Effect: " + setEffect);
Serial.println("Set Effect: " + setEffect);
setPower = "ON";
setPower = "ON";
client.publish(setpowerpub, "ON");
client.publish(setpowerpub, "ON");
if (setEffect == "Twinkle") {
if (setEffect == "Twinkle") {
twinklecounter = 0;
twinklecounter = 0;
}
}
if (setEffect == "Lightning") {
if (setEffect == "Lightning") {
twinklecounter = 0;
twinklecounter = 0;
}
}
}
}




if (String(topic) == setbrightness) {
if (String(topic) == setbrightness) {
for (i = 0; i < length; i++) {
for (i = 0; i < length; i++) {
message_buff[i] = payload[i];
message_buff[i] = payload[i];
}
}
message_buff[i] = '\0';
message_buff[i] = '\0';
setBrightness = String(message_buff);
setBrightness = String(message_buff);
Serial.println("Set Brightness: " + setBrightness);
Serial.println("Set Brightness: " + setBrightness);
brightness = setBrightness.toInt();
brightness = setBrightness.toInt();
setPower = "ON";
setPower = "ON";
client.publish(setpowerpub, "ON");
client.publish(setpowerpub, "ON");
}
}


if (String(topic) == setcolorsub) {
if (String(topic) == setcolorsub) {
for (i = 0; i < length; i++) {
for (i = 0; i < length; i++) {
message_buff[i] = payload[i];
message_buff[i] = payload[i];
}
}
message_buff[i] = '\0';
message_buff[i] = '\0';
client.publish(setcolorpub, message_buff);
client.publish(setcolorpub, message_buff);
setColor = String(message_buff);
setColor = String(message_buff);
Serial.println("Set Color: " + setColor);
Serial.println("Set Color: " + setColor);
setPower = "ON";
setPower = "ON";
client.publish(setpowerpub, "ON");
client.publish(setpowerpub, "ON");
}
}


if (String(topic) == setanimationspeed) {
if (String(topic) == setanimationspeed) {
for (i = 0; i < length; i++) {
for (i = 0; i < length; i++) {
message_buff[i] = payload[i];
message_buff[i] = payload[i];
}
}
message_buff[i] = '\0';
message_buff[i] = '\0';
setAnimationSpeed = String(message_buff);
setAnimationSpeed = String(message_buff);
animationspeed = setAnimationSpeed.toInt();
animationspeed = setAnimationSpeed.toInt();
}
}
}
}






void loop() {
void loop() {


if (!client.connected()) {
if (!client.connected()) {
reconnect();
reconnect();
}
}


if (WiFi.status() != WL_CONNECTED) {
if (WiFi.status() != WL_CONNECTED) {
delay(1);
delay(1);
Serial.print("WIFI Disconnected. Attempting reconnection.");
Serial.print("WIFI Disconnected. Attempting reconnection.");
setup_wifi();
setup_wifi();
return;
return;
}
}






client.loop();
client.loop();


ArduinoOTA.handle();
ArduinoOTA.handle();




int Rcolor = setColor.substring(0, setColor.indexOf(',')).toInt();
int Rcolor = setColor.substring(0, setColor.indexOf(',')).toInt();
int Gcolor = setColor.substring(setColor.indexOf(',') + 1, setColor.lastIndexOf(',')).toInt();
int Gcolor = setColor.substring(setColor.indexOf(',') + 1, setColor.lastIndexOf(',')).toInt();
int Bcolor = setColor.substring(setColor.lastIndexOf(',') + 1).toInt();
int Bcolor = setColor.substring(setColor.lastIndexOf(',') + 1).toInt();


if (setPower == "OFF") {
if (setPower == "OFF") {
setEffect = "Solid";
setEffect = "Solid";
for ( int i = 0; i < NUM_LEDS; i++) {
for ( int i = 0; i < NUM_LEDS; i++) {
leds[i].fadeToBlackBy( 8 ); //FADE OFF LEDS
leds[i].fadeToBlackBy( 8 ); //FADE OFF LEDS
}
}
}
}
/////////////////////////////////////////
/////////////////////////////////////////
//////DrZzs custom effects//////////////
//////DrZzs custom effects//////////////
///////////////////////////////////////
///////////////////////////////////////


if (setEffect == "Christmas") { // colored stripes pulsing in Shades of GREEN and RED
if (setEffect == "Christmas") { // colored stripes pulsing in Shades of GREEN and RED
uint8_t BeatsPerMinute = 62;
uint8_t BeatsPerMinute = 62;
CRGBPalette16 palette = bhw2_xmas_gp;
CRGBPalette16 palette = bhw2_xmas_gp;
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
for( int i = 0; i < NUM_LEDS; i++) { //9948
for( int i = 0; i < NUM_LEDS; i++) { //9948
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
}
}
}
}


if (setEffect == "St Patty") { // colored stripes pulsing in Shades of GREEN
if (setEffect == "St Patty") { // colored stripes pulsing in Shades of GREEN
uint8_t BeatsPerMinute = 62;
uint8_t BeatsPerMinute = 62;
CRGBPalette16 palette = bhw2_greenman_gp;
CRGBPalette16 palette = bhw2_greenman_gp;
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
for( int i = 0; i < NUM_LEDS; i++) { //9948
for( int i = 0; i < NUM_LEDS; i++) { //9948
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
}
}
}
}


if (setEffect == "Valentine") { // colored stripes pulsing in Shades of PINK and RED
if (setEffect == "Valentine") { // colored stripes pulsing in Shades of PINK and RED
uint8_t BeatsPerMinute = 62;
uint8_t BeatsPerMinute = 62;
CRGBPalette16 palette = bhw2_redrosey_gp;
CRGBPalette16 palette = bhw2_redrosey_gp;
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
for( int i = 0; i < NUM_LEDS; i++) { //9948
for( int i = 0; i < NUM_LEDS; i++) { //9948
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
}
}
}
}


if (setEffect == "Turkey Day") { // colored stripes pulsing in Shades of Brown and ORANGE
if (setEffect == "Turkey Day") { // colored stripes pulsing in Shades of Brown and ORANGE
uint8_t BeatsPerMinute = 62;
uint8_t BeatsPerMinute = 62;
CRGBPalette16 palette = bhw2_thanks_gp;
CRGBPalette16 palette = bhw2_thanks_gp;
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
for( int i = 0; i < NUM_LEDS; i++) { //9948
for( int i = 0; i < NUM_LEDS; i++) { //9948
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
}
}
}
}


if (setEffect == "Thanksgiving") { // colored stripes pulsing in Shades of Red and ORANGE and Green
if (setEffect == "Thanksgiving") { // colored stripes pulsing in Shades of Red and ORANGE and Green
static uint8_t startIndex = 0;
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* higher = faster motion */
startIndex = startIndex + 1; /* higher = faster motion */


fill_palette( leds, NUM_LEDS,
fill_palette( leds, NUM_LEDS,
startIndex, 16, /* higher = narrower stripes */
startIndex, 16, /* higher = narrower stripes */
ThxPalettestriped, 255, LINEARBLEND);
ThxPalettestriped, 255, LINEARBLEND);
}
}
if (setEffect == "USA") { // colored stripes pulsing in Shades of Red White & Blue
if (setEffect == "USA") { // colored stripes pulsing in Shades of Red White & Blue
uint8_t BeatsPerMinute = 62;
uint8_t BeatsPerMinute = 62;
CRGBPalette16 palette = bhw3_41_gp;
CRGBPalette16 palette = bhw3_41_gp;
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
for( int i = 0; i < NUM_LEDS; i++) { //9948
for( int i = 0; i < NUM_LEDS; i++) { //9948
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
}
}
}
}


if (setEffect == "Independence") { // colored stripes of Red White & Blue
if (setEffect == "Independence") { // colored stripes of Red White & Blue
static uint8_t startIndex = 0;
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* higher = faster motion */
startIndex = startIndex + 1; /* higher = faster motion */


fill_palette( leds, NUM_LEDS,
fill_palette( leds, NUM_LEDS,
startIndex, 16, /* higher = narrower stripes */
startIndex, 16, /* higher = narrower stripes */
IndPalettestriped, 255, NOBLEND);
IndPalettestriped, 255, NOBLEND);
}
}


if (setEffect == "Go Blue") { // colored stripes pulsing in Shades of Maize and Blue
if (setEffect == "Go Blue") { // colored stripes pulsing in Shades of Maize and Blue
uint8_t BeatsPerMinute = 62;
uint8_t BeatsPerMinute = 62;
CRGBPalette16 palette = Pills_3_gp;
CRGBPalette16 palette = Pills_3_gp;
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
for( int i = 0; i < NUM_LEDS; i++) { //9948
for( int i = 0; i < NUM_LEDS; i++) { //9948
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10));
}
}
}
}


if (setEffect == "Hail") {
if (setEffect == "Hail") {
static uint8_t startIndex = 0;
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* higher = faster motion */
startIndex = startIndex + 1; /* higher = faster motion */


fill_palette( leds, NUM_LEDS,
fill_palette( leds, NUM_LEDS,
startIndex, 16, /* higher = narrower stripes */
startIndex, 16, /* higher = narrower stripes */
hailPalettestriped, 255, LINEARBLEND);
hailPalettestriped, 255, LINEARBLEND);
}
}
if (setEffect == "Touchdown") { //Maize and Blue with POLICE ALL animation
if (setEffect == "Touchdown") { //Maize and Blue with POLICE ALL animation
idex++;
idex++;
if (idex >= NUM_LEDS) {
if (idex >= NUM_LEDS) {
idex = 0;
idex = 0;
}
}
int idexY = idex;
int idexY = idex;
int idexB = antipodal_index(idexY);
int idexB = antipodal_index(idexY);
int thathue = (thishuehail + 96) % 255;
int thathue = (thishuehail + 96) % 255;
leds[idexY] = CHSV(thishuehail, thissat, 255);
leds[idexY] = CHSV(thishuehail, thissat, 255);
leds[idexB] = CHSV(thathue, thissat, 255);
leds[idexB] = CHSV(thathue, thissat, 255);
}
}


if (setEffect == "Lovey Day") { //Valentine's Day colors (TWO COLOR SOLID)
if (setEffect == "Lovey Day") { //Valentine's Day colors (TWO COLOR SOLID)
idex++;
idex++;
if (idex >= NUM_LEDS) {
if (idex >= NUM_LEDS) {
idex = 0;
idex = 0;
}
}
int idexR = idex;
int idexR = idex;
int idexB = antipodal_index(idexR);
int idexB = antipodal_index(idexR);
int thathue = (thishueLovey + 244) % 255;
int thathue = (thishueLovey + 244) % 255;
leds[idexR] = CHSV(thishueLovey, thissat, 255);
leds[idexR] = CHSV(thishueLovey, thissat, 255);
leds[idexB] = CHSV(thathue, thissat, 255);
leds[idexB] = CHSV(thathue, thissat, 255);
}
}


if (setEffect == "Holly Jolly") {
if (setEffect == "Holly Jolly") {
static uint8_t startIndex = 0;
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* higher = faster motion */
startIndex = startIndex + 1; /* higher = faster motion */


fill_palette( leds, NUM_LEDS,
fill_palette( leds, NUM_LEDS,
startIndex, 16, /* higher = narrower stripes */
startIndex, 16, /* higher = narrower stripes */
HJPalettestriped, 255, NOBLEND);
HJPalettestriped, 255, NOBLEND);
}
}


/////////////////End DrZzs effects/////////////
/////////////////End DrZzs effects/////////////
///////////////////////////////////////////////
///////////////////////////////////////////////


////////My custom effects below////////////
////////My custom effects below////////////
if (setEffect == "Strobe") {
Strobe();
}
if (setEffect == "C9") {
if (setEffect == "C9") {
FillLEDsFromPaletteColors( colorIndex);
FillLEDsFromPaletteColors( colorIndex);
}
}


if (setEffect == "C9 Moving") {
if (setEffect == "C9 Moving") {
FillLEDsFromPaletteColors( colorIndex);
FillLEDsFromPaletteColors( colorIndex);
colorIndex++;
colorIndex++;
}
}


if (setEffect == "Red Green White") { //Red Green and White
if (setEffect == "Red Green White") { //Red Green and White
static uint8_t startIndex = 0;
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* higher = faster motion */
startIndex = startIndex + 1; /* higher = faster motion */


fill_palette( leds, NUM_LEDS,
fill_palette( leds, NUM_LEDS,
startIndex, 16, /* higher = narrower stripes */
startIndex, 16, /* higher = narrower stripes */
RGWPalettestriped, 255, NOBLEND);
RGWPalettestriped, 255, NOBLEND);
}
}


if (setEffect == "Red Green With Glitter") { //Red Green colors with Glitter
if (setEffect == "Red Green With Glitter") { //Red Green colors with Glitter
static uint8_t startIndex = 0;
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* higher = faster motion */
startIndex = startIndex + 1; /* higher = faster motion */


fill_palette( leds, NUM_LEDS,
fill_palette( leds, NUM_LEDS,
startIndex, 16, /* higher = narrower stripes */
startIndex, 16, /* higher = narrower stripes */
RGPalettestriped, 255, NOBLEND);
RGPalettestriped, 255, NOBLEND);
addGlitter(320);
addGlitter(320);
}
}


if (setEffect == "Orange & Purple EFFECT") { //Orange and Purple colors (TWO COLOR SOLID)
if (setEffect == "Orange & Purple EFFECT") { //Orange and Purple colors (TWO COLOR SOLID)
idex++;
idex++;
if (idex >= NUM_LEDS) {
if (idex >= NUM_LEDS) {
idex = 0;
idex = 0;
}
}
int idexR = idex;
int idexR = idex;
int idexB = antipodal_index(idexR);
int idexB = antipodal_index(idexR);
int thathue = (thishueHalloween + 170) % 255;
int thathue = (thishueHalloween + 170) % 255;
leds[idexR] = CHSV(thishueHalloween, thissat, 255);
leds[idexR] = CHSV(thishueHalloween, thissat, 255);
leds[idexB] = CHSV(thathue, thissat, 255);
leds[idexB] = CHSV(thathue, thissat, 255);
}
}


if (setEffect == "Orange & Green EFFECT") { //Orange and Green colors (TWO COLOR SOLID)
if (setEffect == "Orange & Green EFFECT") { //Orange and Green colors (TWO COLOR SOLID)
idex++;
idex++;
if (idex >= NUM_LEDS) {
if (idex >= NUM_LEDS) {
idex = 0;
idex = 0;
}
}
int idexR = idex;
int idexR = idex;
int idexB = antipodal_index(idexR);
int idexB = antipodal_index(idexR);
int thathue = (thishueHalloween2 + 66) % 255;
int thathue = (thishueHalloween2 + 66) % 255;
leds[idexR] = CHSV(thishueHalloween2, thissat, 255);
leds[idexR] = CHSV(thishueHalloween2, thissat, 255);
leds[idexB] = CHSV(thathue, thissat, 255);
leds[idexB] = CHSV(thathue, thissat, 255);
}
}


if (setEffect == "Purple & Green EFFECT") { //Purple and Green colors (TWO COLOR SOLID)
if (setEffect =
idex++;
if (idex >= NUM_LEDS) {
idex = 0;
}
int idexR = idex;
int idexB = antipodal_index(idexR);
int thathue = (thishueHalloween3 + 96) % 255;
leds[idexR] = CHSV(t