I totally just figured out why there was a delay. I've been slowly, but surely cleaning up my code and making all of my settings into voids that I can call as colors, and had a straggler delay left in my loop. That solved that issue, but I'm curious as to what you think about the reset so I'll post it anyway. It isn't all of the time that it reset, so I'm concerned about voltage drop, but i've tested for voltage drop and my leds are powered externally not via output pins. The part I was talking about starts on line 126.
#include "FastLED.h"
#define NUM_LEDS 100
#define DATA_PIN 8
CRGB leds[NUM_LEDS];
int Bvalue = 40;
int Rvalue = 140;
int Left[]= {0,1,2,3,4,5,16,17,18,19,20,26,27,28,29,30,36,37,38,39,40,46,47,48,49,50,56,57,58,59,60,66,67,68,69,70,76,77,78,79,80,86,87,88,89,90,96,97,98,99,100};
int cycle = 0;
/////////////// Switch 1 (eyes / vents / mouth cycle)
int S1 = 1;
int S1B = 0;
int S1Val = 0;
///////////////
/////////////// Switch 2 (battery)
int S2 = 1;
int S2B = 0;
int S2Val = 0;
///////////////
/////////////// Switch 3 (el wire)
int S3 = 1;
int S3B = 0;
int S3Val = 0;
///////////////
/////////////// Switch 4 (fan)
int S4 = 1;
int S4B = 0;
int S4Val = 0;
///////////////
int VAL=0;
void setup() {
pinMode(13, INPUT);
pinMode(6, OUTPUT);
pinMode(8, OUTPUT);
FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
delay(200);
START();
Serial.begin(9600);
}
void loop() {
SWITCH1();
///////////////////////// BASIC COLORS (ON SWITCH 1)
if (S1Val == 100) {
OFF();
}
if (S1Val == 100) {
RED();
}
if (S1Val == 2) {
ORANGE();
}
if (S1Val == 3) {
YELLOW();
}
if (S1Val == 4) {
GREEN();
}
if (S1Val == 5) {
BLUE();
}
if (S1Val == 6) {
PURPLE();
}
if (S1Val == 7) {
WHITE();
}
////////////////////////// OTHER COLORS
if (S1Val == 8) {
FLASH();
}
if (S1Val == 9) {
STROBE();
}
if (S1Val == 10) {
SHIMMER();
}
if (S1Val == 11) {
SHIMMERbp();
}
if (S1Val == 10) {
leds[0] = CRGB(20,40,90);
FastLED.show();
}
if (S1Val == 0) {
for(cycle = 0; cycle < 9; cycle++){
leds[Left[cycle]] = CRGB(0, 100, 0);
}
FastLED.show();
delay(1000);
for(cycle = 0; cycle < 9; cycle++){
leds[Left[cycle]] = CRGB(100, 0, 0);
}
FastLED.show();
delay(1000);
}
//////////////////////////
SWITCH1RESET();
Serial.println(S1Val);
}
//////////////////////////////// END OF LOOP
void START()
{ analogWrite(3, 2);
analogWrite(5, 90);
analogWrite(6, 20);
fill_solid(leds, NUM_LEDS, CRGB(0, 100, 0));
FastLED.show();
delay(200);
analogWrite(3, 0);
analogWrite(5, 0);
analogWrite(6, 0);
fill_solid(leds, NUM_LEDS, CRGB(0, 0, 0));
FastLED.show();
delay(200);
analogWrite(3, 2);
analogWrite(5, 90);
analogWrite(6, 20);
fill_solid(leds, NUM_LEDS, CRGB(0, 100, 0));
FastLED.show();
delay(200);
analogWrite(3, 0);
analogWrite(5, 0);
analogWrite(6, 0);
fill_solid(leds, NUM_LEDS, CRGB(0, 0, 0));
FastLED.show();
}
void SWITCH1RESET()
{ if (S1Val == 12) {
S1Val = 0;
}
}
void SWITCH1()
{ S1 = digitalRead(13);
if (S1 == S1B) {
S1Val++;
S1B = 2;
}
if (S1 == 1) {
S1B = 0;
}
}
///////////COLOR FUNCTIONS////////////////
void OFF()
{ fill_solid(leds, NUM_LEDS, CRGB(0, 0, 0));
FastLED.show();
analogWrite(3, 0);
analogWrite(5, 0);
analogWrite(6, 0);
}
void RED()
{ fill_solid(leds, NUM_LEDS, CRGB(100, 0, 5));
FastLED.show();
analogWrite(6, 150);
}
void ORANGE()
{ fill_solid(leds, NUM_LEDS, CRGB(75, 40, 0));
FastLED.show();
analogWrite(3, 0);
analogWrite(5, 15);
analogWrite(6, 150);
}
void YELLOW()
{ fill_solid(leds, NUM_LEDS, CRGB(60, 70, 0));
FastLED.show();
analogWrite(3, 0);
analogWrite(5, 40);
analogWrite(6, 100);
}
void GREEN()
{ fill_solid(leds, NUM_LEDS, CRGB(0, 120, 20));
FastLED.show();
analogWrite(3, 2);
analogWrite(5, 90);
analogWrite(6, 20);
}
void BLUE()
{ fill_solid(leds, NUM_LEDS, CRGB(10, 1, 100));
FastLED.show();
analogWrite(3, 60);
analogWrite(6, 5);
}
void PURPLE()
{ fill_solid(leds, NUM_LEDS, CRGB(30, 0, 90));
FastLED.show();
analogWrite(3, 200);
analogWrite(6, 120);
}
void WHITE()
{ fill_solid(leds, NUM_LEDS, CRGB(30, 40, 40));
FastLED.show();
analogWrite(3, 75);
analogWrite(5, 110);
analogWrite(6, 100);
}
void FLASH() {
EVERY_N_MILLISECONDS( 200 ) {
fill_solid(leds, NUM_LEDS, CRGB(30, 40, 40));
FastLED.show();
analogWrite(3, 75);
analogWrite(5, 110);
analogWrite(6, 100);
}
EVERY_N_MILLISECONDS( 400 ) {
fill_solid(leds, NUM_LEDS, CRGB(0, 0, 0));
FastLED.show();
analogWrite(3, 0);
analogWrite(5, 0);
analogWrite(6, 0);
}
}
void STROBE() {
EVERY_N_MILLISECONDS( 200 ) {
fill_solid(leds, NUM_LEDS, CRGB(60, 70, 70));
FastLED.show();
analogWrite(3, 75);
analogWrite(5, 110);
analogWrite(6, 100);
}
EVERY_N_MILLISECONDS( 50 ) {
fill_solid(leds, NUM_LEDS, CRGB(0, 0, 0));
FastLED.show();
analogWrite(3, 0);
analogWrite(5, 0);
analogWrite(6, 0);
}
}
void SHIMMER() {
analogWrite(3, 75);
analogWrite(5, 110);
analogWrite(6, 100);
delay(50);
leds[random(1, 100)] = CRGB(30, 40, 40);
FastLED.show();
delay(50);
fill_solid(leds, NUM_LEDS, CRGB(0, 0, 0));
}
void SHIMMERbp() {
analogWrite(3, 40);
analogWrite(5, 40);
analogWrite(6, 150);
delay(50);
leds[random(1,100)] = CRGB(Rvalue, 20, Bvalue);
FastLED.show();
leds[random(1,100)] = CRGB(Rvalue, 20, Bvalue);
FastLED.show();
delay(50);
fill_solid(leds, NUM_LEDS, CRGB(0, 0, 0));
Bvalue = Bvalue+1;
Rvalue = Rvalue-1;
if (Bvalue == 140) {
Rvalue = 140;
Bvalue = 40;
}
}