 
 void setup() 
 {
+    //retrieve persisted state
     EEPROM.get(EEPROM_ADDR_STRIP_0, stripObj0);
     EEPROM.get(EEPROM_ADDR_STRIP_1, stripObj1);
     EEPROM.get(EEPROM_ADDR_STRIP_2, stripObj2);
     EEPROM.get(EEPROM_ADDR_PINS, pinObj);
     EEPROM.get(EEPROM_BRIGHTNESS, brightness);
+    _brightness = (int)brightness;
 
     Serial.begin(9600);  
+
     strip2.begin();
-    strip2.show(); // Initialize all pixels to 'off'
-    //register the run command as an API endpoint
+    strip2.show();
+
+    //regiser cloud variables and the run function
     Particle.function("run", run);
-    //register the action variable as a GET parameter
     Particle.variable("action", action, STRING);
-    //register the parameters variable as a GET parameter
     Particle.variable("parameters", parameters, STRING);
+    Particle.variable("brightness", &_brightness, INT);
 
     pinMode(PIN_0, OUTPUT);
     pinMode(PIN_1, OUTPUT);

    {
        Serial.println("Reseting state");
        brightness = 255;
        EEPROM.put(EEPROM_BRIGHTNESS, 255);
    }
    else

#define SETALL "setAll"
#define LOOPALTERNATE "loopAlternate"
#define LOOPBLOCKS "loopBlocks"
#define ENDRUN "endrun"
#define SNOW "snow"
#define SETBRIGHTNESS "setBrightness"
#define USA "usa"
#define LIGHTNING "lightning"
