  * 6 empty slots, for future expansion
 */
 
-int particleParams[] = {
-    1, 0, 0, 2, 66, 66, 66, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
-    1, 0, 1, 2, 66, 66, 66, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
-    1, 0, 0, 4, 127, 0, 0, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
-    1, 0, 1, 4, 0, 0, 127, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+int particleParams1[] = {
+    1, 0, 0, 2, 66, 66, 66, 127, 1, 1, 0, 0, 0, 0, 0, 0,  
+    1, 0, 1, 2, 66, 66, 66, 127, 1, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 0, 4, 127, 0, 0, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 1, 4, 0, 0, 127, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
     0, 0, 1, 2, 127, 127, 127, 127, 0, 1, 0, 0, 0, 0, 0, 0
 };
+						
+int particleParams2[] = {
+    1, 0, 0, 4, 43, 43, 43, 127, 1, 1, 0, 0, 0, 0, 0, 0,  
+    1, 0, 1, 4, 0, 0, 127, 127, 1, 1, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 2, 66, 66, 66, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 1, 2, 66, 66, 66, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 1, 2, 127, 127, 127, 127, 0, 1, 0, 0, 0, 0, 0, 0
+};
+
+int particleParams3[] = {
+    1, 0, 0, 2, 0, 0, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0,  
+    0, 0, 1, 2, 66, 66, 66, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 0, 4, 127, 0, 0, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 1, 4, 0, 0, 127, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 1, 2, 127, 127, 127, 127, 0, 1, 0, 0, 0, 0, 0, 0
+};
+
+int particleParams4[] = {
+    1, 0, 0, 2, 43, 43, 43, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+    1, 11, 0, 2, 0, 66, 66, 127, 1, 1, 0, 0, 0, 0, 0, 0,  
+    1, 22, 0, 2, 0, 0, 127, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 1, 4, 0, 0, 127, 127, 1, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 1, 2, 127, 127, 127, 127, 0, 1, 0, 0, 0, 0, 0, 0
+};
+
+int particleParams5[] = {
+    1, 0, 0, 2, 66, 66, 66, 127, 1, 1, 0, 0, 0, 0, 0, 0,  
+    1, 16, 0, 2, 66, 66, 66, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 0, 4, 127, 0, 0, 127, 1, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 1, 4, 0, 0, 127, 127, 0, 1, 0, 0, 0, 0, 0, 0,  
+    0, 0, 1, 2, 127, 127, 127, 127, 0, 1, 0, 0, 0, 0, 0, 0
+};
+
+int activeParticleParams[80];
+
+/* arrays store xx parameters defining a ring pattern. Params are:
+ * style - 0: pulse
+ * rate
+ * red val (127 max)
+ * green val
+ * blue val
+ * brightness
+ * 6 empty slots, for future expansion 
+*/
+int ringParams1[] = {1, 32, 43, 43, 43, 127, 0, 0, 0, 0, 0, 0};
+int ringParams2[] = {1, 32, 0, 66, 66, 127, 0, 0, 0, 0, 0, 0};
+int ringParams3[] = {0, 64, 0, 66, 66, 127, 0, 0, 0, 0, 0, 0};
+int ringParams4[] = {1, 32, 0, 0, 127, 127, 0, 0, 0, 0, 0, 0};
+int ringParams5[] = {1, 64, 0, 0, 127, 127, 0, 0, 0, 0, 0, 0};
+
+int activeRingParams[12];
+
+int buttonReading; // the current reading from the input pin
+int previousReading = LOW; // the previous reading from the input pin
+
+// the follow variables are longs because the time, measured in miliseconds, will quickly become a bigger number than can be stored in an int.
+long time = 0; // the last time the output pin was toggled
+long debounce = 100; // the debounce time, increase if the output flickers
 
 String inputString = "";
-String mode = "";
-
 boolean stringComplete = false;
 
 void setup() {

}

void renderParticles() {
    for (int i=0; i<maxParticles; i++) {
        int pActive = particleParams[i*16];		
        if (pActive == 1) {
            int pPos = particleParams[i*16+1];		
            int pDirection = particleParams[i*16+2];
            int pSpeed = particleParams[i*16+3];	
            int pRVal = particleParams[i*16+4];
            int pGVal = particleParams[i*16+5];
            int pBVal = particleParams[i*16+6];
            int pBrightness = particleParams[i*16+7];
            int pCoronaLeading = particleParams[i*16+8];
            int pCoronaTrailing = particleParams[i*16+9];

            // if based on the particle's speed it should move on this frame
            if (counter % pSpeed == 0) { // if this particle rotates clockwise...
                if (pDirection == 1) { // if this particle has reached the end of the strip...
                    if ((pPos + 1) == (nLEDs)) {
                        pPos = 0;
                    } else {
                        pPos = pPos+1;
                    }
                } else { // else, if this particle rotates counter clockwise
                    if (pPos-1 < 0) {
                        pPos = nLEDs-1;
                    } else {
                        pPos--;
                    }
                }
                particleParams[i*16+1] = pPos;
            }
            // note the Color | Color argument blends the existing color (if any) of the pixel with the newly calculated color - so particle overlaps look right
            strip.setPixelColor(pPos, strip.Color(pRVal, pGVal, pBVal) | strip.getPixelColor(pPos));
			
            /* PLACEHOLDER CODE - replace with proper corona code */
            if (pPos-1 < 0) {
                pPos = nLEDs-1;
            } else {
                pPos = pPos-1;
            }
            strip.setPixelColor(pPos, strip.Color(calculateBrightness(pRVal, 15), calculateBrightness(pGVal, 15), calculateBrightness(pBVal, 15)) | strip.getPixelColor(pPos));

            if (pPos-1 < 0) {
                pPos = nLEDs-1;
            } else {
                pPos = pPos-1;
            }
            strip.setPixelColor(pPos, strip.Color(calculateBrightness(pRVal, 5), calculateBrightness(pGVal, 5), calculateBrightness(pBVal, 5)) | strip.getPixelColor(pPos));
        }
    }
}

// turn all pixels off

 * LPD8806 pin assignments
 * DATA    2
 * CLOCK   3
 * MODE    6
 */

#include <SPI.h>
