     Serial.println(command);
 
     if( command.substring(0,9) == "Light ON;" ) {
+      lightOn = HIGH;
       digitalWrite( LED_PIN, HIGH );
     }
     else if ( command.substring(0,10) == "Light OFF;" ) {
+      lightOn = LOW;
       digitalWrite( LED_PIN, LOW );
     }
     else if ( command.substring(0,5) == "Servo" ) {
-        String servoSpeed = command.substring(6,command.indexOf(';'));
-        analogWrite(SERVO_PIN, servoSpeed.toInt());
+        String servoPos = command.substring(6,command.indexOf(';'));
+        myservo.write(servoPos.toInt());
     }
 
     

  //read from button
  int newBtnState = digitalRead(BTN_PIN);
  if( newBtnState != buttonState ) {
    
    buttonState = newBtnState;
    String sendCommand = "BTN " + String(buttonState);
    for( int i = 0; i < sendCommand.length(); i++ ) {
      ble_write( sendCommand[i] );
    }
  }

  //read from pot
  int newPotVal = analogRead(POT_PIN);
  if( newPotVal != potVal ) {
    
    potVal = newPotVal;
    int newBrightness = potVal/4;
    analogWrite(LED_PIN, newBrightness);
    String sendCommand = "POT " + String(potVal);
    for( int i = 0; i < sendCommand.length(); i++ ) {
      ble_write( sendCommand[i] );
    }
  }

  delay(10);

String command;
int buttonState = 0;
int potVal = 0;
bool lightOn = LOW;
int strobeMode = 0;

int delayVals[4] = {0,100,70,30};

void loop()
{
