user47396: I want to make my servo react on the data that my light sensor tells him by the amount of light that it is catching. I want the servo to go fast to the left when there is shadow/darkness and then I want it to go slowly back to the right when the light is back. 
This is the code I´m now using for my 180 degrees servo.
I also want this to work on my 360 degrees servo but because I am a beginner, I can´t figure it out...
#include <Servo.h>

Servo s;

void setup() {
  // put your setup code here, to run once:
  //pinMode(9,OUTPUT);
  pinMode(A0, INPUT);
  Serial.begin(9600);
  s.attach(9);
}

void loop() {
   float l = analogRead(A0);
   Serial.print(l);
   Serial.print(" ");
   int v = map(l,0,1024,0,179);
   s.write(v);
   Serial.println(v);

}




user313: The servo's rotation speed is controlled by its internal circuitry. Once you send it a new target position, it drives at it's maximum speed toward that position and decelerates as it approaches.
The best you can do to slow it down is to change its target stepwise, until you reach the target position, instead of setting the final target all at once. If you move it in several large steps, the motion will be jerky; if you send smaller steps at shorter intervals (so the total travel time will be same), the motion will get smoother.
If your application needs the smoothest motion possible, send it many tiny steps rapidly, again, observing your required total travel time. You should be able keep the servo constantly at (or closer to) it's approach speed.

47396: <p>I want to make my servo react on the data that my light sensor tells him by the amount of light that it is catching. I want the servo to go fast to the left when there is shadow/darkness and then I want it to go slowly back to the right when the light is back. </p>

<p>This is the code I´m now using for my 180 degrees servo.
I also want this to work on my 360 degrees servo but because I am a beginner, I can´t figure it out...</p>

<pre><code>#include &lt;Servo.h&gt;

Servo s;

void setup() {
  // put your setup code here, to run once:
  //pinMode(9,OUTPUT);
  pinMode(A0, INPUT);
  Serial.begin(9600);
  s.attach(9);
}

void loop() {
   float l = analogRead(A0);
   Serial.print(l);
   Serial.print(" ");
   int v = map(l,0,1024,0,179);
   s.write(v);
   Serial.println(v);

}
</code></pre>

<p><a href="https://i.stack.imgur.com/jnQlm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jnQlm.jpg" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/CXWAM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CXWAM.jpg" alt="enter image description here"></a></p>
 313: <p>The servo's rotation speed is controlled by its internal circuitry. Once you send it a new target position, it drives at it's maximum speed toward that position and decelerates as it approaches.</p>

<p>The best you can do to slow it down is to change its target stepwise, until you reach the target position, instead of setting the final target all at once. If you move it in several large steps, the motion will be jerky; if you send smaller steps at shorter intervals (so the total travel time will be same), the motion will get smoother.</p>

<p>If your application needs the smoothest motion possible, send it many tiny steps rapidly, again, observing your required total travel time. You should be able keep the servo constantly at (or closer to) it's approach speed.</p>
