 
   pinMode(BTN_PIN,INPUT);
   pinMode(LED_PIN,OUTPUT);
-  pinMode(SERVO_PIN, OUTPUT);
   pinMode(POT_PIN, INPUT);
   digitalWrite( LED_PIN, LOW );
+
+  myservo.attach(SERVO_PIN);
   
   // Init. and start BLE library.
   ble_begin();

String command;
int buttonState = 0;
int potVal = 0;

void loop()
{

  //read from button
  int newBtnState = digitalRead(BTN_PIN);
  if( newBtnState != buttonState ) {

    //send button state along BLE
    buttonState = newBtnState;
    String sendCommand = "BTN " + String(buttonState);
    for( int i = 0; i < sendCommand.length(); i++ ) {
      ble_write( sendCommand[i] );
    }

    // update button state when button is pressed
    if(buttonState==1) {
      strobeMode += 1;

      //reset strobeMode if it's greater than 3
      if(strobeMode > 3) {
        strobeMode = 0;
      }
    }
  }

  //read from pot
  int newPotVal = analogRead(POT_PIN);
  if( newPotVal != potVal ) {

    //update potentiometer value
    potVal = newPotVal;

    //send the potentiometer value along BLE
    String sendCommand = "POT " + String(potVal);
    for( int i = 0; i < sendCommand.length(); i++ ) {
      ble_write( sendCommand[i] );
    }
  }


  // determine strobe mode
  if(lightOn) {
    //turn LED off
    digitalWrite(LED_PIN,LOW);
    analogWrite(LED_PIN, 0);

    //wait a certain amount of time
    delay( delayVals[strobeMode] );
    

    //turn LED back on
    digitalWrite(LED_PIN,HIGH);
    int newBrightness = potVal/4;
    analogWrite(LED_PIN, newBrightness);
  }

  delay(10);
