Arduino servo acts weird with photocell (lightsensor) I have a weird thing with my servo, I really dont know what is wrong with my code, I tried everything. Either it is my connection on arduino or my code. Please help me guys, this is my code.

#include &lt;Servo.h&gt;     

int servoPin = 9;     
Servo servo;          
int angle = 0;         
int photocellPin = 0;  

void setup() { 
  servo.attach(servoPin);  
} 

void loop() { 
  int reading = analogRead(photocellPin);     
  Serial.print("Reading = ");
  Serial.println(photocellPin);
  int newAngle = reading / 2;             
  servo.write(newAngle);  
  delay(80);                      
}
Servos accept a signal from 0 to 180, with 90 being the center point on the servo. analogRead() will output a number from 0 to 1023. The arduino "map" function makes a conversion easy to do. just replace

int newAngle = reading / 2;


with

int newAngle = map(reading, 0, 1023, 0, 180);


you can read more about the map function here: http://arduino.cc/en/reference/map

It is hard to tell from the picture that everything else is wired correctly, but this should fix up your code.