 int				flameInterval;
 int				glowDiv[numPixels];
 
-boolean			glowIncrease, glowDoChange;
-boolean			increaseDirection = true;
-boolean			twinkleIncrease = true;
-boolean			twinklePause = true;
+bool			glowIncrease, glowDoChange;
+bool			increaseDirection = true;
+bool			twinkleIncrease = true;
+bool			twinklePause = true;
 
 // Color schemes
-enum			color { 
-					rnd, off, white, 
-					warmwhite, red, green, 
+enum			color {
+					rnd, off, white,
+					warmwhite, red, green,
 					blue, yellow, orange
 				};
 

		timer = millis();
	}

	if(millis() > timer + twinklePauseInterval && twinkleIncrease && twinklePause)
	{ 
		twinklePause = false;
		twinkleIncrease = false;
		timer = millis();
	}

	if(millis() > timer + twinkleInterval && !twinkleIncrease && !twinklePause)
	{
		currentBrightness--;

		strip.setPixelColor(twinkleCurrentPixel, color1, color2, color3); 
		strip.setBrightness(currentBrightness);
		strip.show();


		timer = millis();
	}

	if(millis() > timer + twinklePauseInterval && !twinkleIncrease && twinklePause) {
		twinklePause = false;
		twinkleIncrease = true;
		twinkleCurrentPixel = random(0,numPixels);
		if(color == rnd && moreRandom) setColor(color);
		timer = millis();
	}
}

void glow(int color) {

	if(millis() > timer + glowInterval) {

		if(currentMode != previousMode) {
			setColor(color);
			previousMode = currentMode;
		}

		for(int a=0; a < numPixels; a++) {

			glowIncrease = random(2);
			glowDoChange = random(2);

			if(glowIncrease && glowDoChange) {
				glowDiv[a] = glowDiv[a] + glowDivDiff;
				if(glowDiv[a] > glowDivMax) glowDiv[a] = glowDivMax;
			}

			else if (!glowIncrease && glowDoChange) {
				glowDiv[a] = glowDiv[a] - glowDivDiff;
				if(glowDiv[a] < glowDivMin) glowDiv[a] = glowDivMin;
			}

			strip.setPixelColor(a,
			(color1 * glowDiv[a]) / glowMultiplier,
			(color2 * glowDiv[a]) / glowMultiplier,
			(color3 * glowDiv[a]) / glowMultiplier);
		}

		strip.setBrightness(maxBrightness);
		strip.show();
		timer = millis();
	}
}

void setup() {

	randomSeed(analogRead(A0));

	strip.begin();
	strip.show();

	pinMode(pixelPin, OUTPUT);
	pinMode(sw1Pin, INPUT_PULLUP);
	pinMode(sw2Pin, INPUT_PULLUP);
}

void loop() {

	currentMode = readSensors();

	if(currentMode == 1) setAll(warmwhite, 255);
	if(currentMode == 2) setAll(rnd, 150);
	if(currentMode == 3) glow(red);
	if(currentMode == 4) twinkle(rnd);
}
