 
 int counter = 0;
 
+void updateLED() {
+  float val = (exp(sin(now/2000.0*PI)) - 0.36787944)*108.0;
+  if(LEDBreathingState & RED_MASK) {
+    analogWrite(RED_PIN, val);
+  }
+  if(LEDBreathingState & YELLOW_MASK) {
+    analogWrite(YELLOW_PIN, val);
+  }
+  if(LEDBreathingState & GREEN_MASK) {
+    analogWrite(GREEN_PIN, val);
+  }
+}
+
 void loop() {
   now = millis();
-  float val;
   if(now >= serialNextCheck) {
     checkSerial();
   }

#define RED_PIN 3
#define YELLOW_PIN 5
#define GREEN_PIN 6

Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 
Adafruit_StepperMotor *myStepper = AFMS.getStepper(200, 2);

    Serial.println("I'm alive");
    keepAliveNextCheck = now + 2000;
  }
  if(LEDBreathingState) {
    updateLED();
  }
}

