 {
   myservo.attach(9);  // attaches the servo on pin 9 to the servo object
   myservo.write(90);
+
+  Serial.begin(9600);      // open the serial port at 9600 bps:    
 }
 
 void loop()
 {
-  const int startAngle = 10;
-  const int endAngle = 170;
+  const int startAngle = 20;
+  const int endAngle = 130;
 
   // milliseconds to wait between servo movement
-  const int delayTime = 25;
+  const int delayTime = 30;
 
   // maximum servo movement per iteration
   const int increment = 3;
 
   // milliseconds to wait at one end point before reversing rotation
-  const int turnaroundTime = 25;
+  const int turnaroundTime = 10;
 
   int angle = 0;
 

    myservo.write(angle);       // tell servo to go to position in variable 'angle'
    delay(delayTime);           // waits for the servo to reach the position

    float rad = angle * degrees_to_radians;
    int increAngle = ceil(increment * sin(rad));

    // note decrement instead of increment
    angle -= increAngle;
  }
}

    myservo.write(angle);       // tell servo to go to position in variable 'angle'
    delay(delayTime);           // waits for the servo to reach the position

    angle += calcDeltaAngle(angle, startAngle, endAngle, increment);
  }

  delay(turnaroundTime);
