 #define NUM_LEDS    60
 CRGB leds[NUM_LEDS];
 
+#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
+ 
+// List of patterns to cycle through.  Each is defined as a separate function below.
+
+typedef uint8_t (*SimplePattern)();
+typedef SimplePattern SimplePatternList[];
+typedef struct { SimplePattern drawFrame;  char name[32]; } PatternAndName;
+typedef PatternAndName PatternAndNameList[];
+ 
+// These times are in seconds, but could be changed to milliseconds if desired;
+// there's some discussion further below.
+ 
+const PatternAndNameList patterns = { 
+  { rainbow,            "Rainbow" },
+  { rainbowWithGlitter, "Rainbow With Glitter" },
+  { confetti,           "Confetti" },
+  { sinelon,            "Sinelon" },
+  { bpm,                "Beat" },
+  { juggle,             "Juggle" },
+  { fire,               "Fire" },
+  { water,              "Water" },
+  { analogClock,        "Analog Clock" },
+  { fastAnalogClock,    "Fast Analog Clock Test" },
+  { showSolidColor,     "Solid Color" }
+};
+
 uint8_t brightness = 32;
 
-int patternCount = 10;
+int patternCount = ARRAY_SIZE(patterns);
 int patternIndex = 0;
 char patternName[32] = "Rainbow";
 int power = 1;


int setPatternName(String args)
{
    int pattern = args.toInt();
    if(pattern < 0)
        pattern = 0;
    else if (pattern >= patternCount)
        pattern = patternCount - 1;
    
    switch(pattern)
    {
        case 0:
        strcpy(patternName, "Rainbow");
        break;
        
        case 1:
        strcpy(patternName, "Rainbow With Glitter");
        break;
      
        case 2:
        strcpy(patternName, "Confetti");
        break;
        
        case 3:
        strcpy(patternName, "Sinelon");
        break;
        
        case 4:
        default:
        strcpy(patternName, "BPM");
        break;
        
        case 5:
        strcpy(patternName, "Juggle");
        break;
        
        case 6:
        strcpy(patternName, "Fire");
        break;
        
        case 7:
        strcpy(patternName, "Analog Clock");
        break;
        
        case 8:
        strcpy(patternName, "Fast Analog Clock");
        break;
        
        case 9:
        strcpy(patternName, "Solid Color");
        break;
  }
  
    return pattern;
}

uint8_t rainbow() 

      return;
  }
  
  uint8_t delay = patterns[patternIndex].drawFrame();
  
  // send the 'leds' array out to the actual LED strip
  FastLED.show();
