 {
   // Read the magnetometer and determine the compass heading:
   lsm.getEvent(&accel, &mag, &gyro, &temp);
-
-  CRGB color = selectColor(fabs(round(mag.magnetic.z * 100)));
-
   // Check for mode change commands
-  CheckForGestures(accel);
-
+  checkForGestures(accel);
+
+  CRGB magHeadingBasedColor = convertHeadingToColor(fabs(round(mag.magnetic.z * 100)));
+
+  if(pendulum == true)
+  {
+    pendulumMode(magHeadingBasedColor);
+  }
+  else 
+  {
+    staticMode(magHeadingBasedColor);
+  }
+
+}
+
+void staticMode(CRGB color)
+{
+  fill_solid(&(rightLense[0]), NUM_LEDS, color);
+  fill_solid(&(leftLense[0]), NUM_LEDS, color);
+  FastLED.show();
+}
+
+void pendulumMode(CRGB color)
+{
   // apply a little frictional damping to keep things in control and prevent perpetual motion
   MomentumH *= friction;
   MomentumV *= friction;

  return value;
}

CRGB selectColor(float heading)
{
  int convertedHeading = map(heading, 0, 51, 0, 255);
  return CHSV(convertedHeading, 255, 180);
}

// monitor orientation for mode-change 'gestures'
void CheckForGestures(sensors_event_t accel)
{
  if (accel.acceleration.x < gestureThreshold)
  {

    }
  }
  FastLED.show();

}

int wrapAround(int value)
