I give you a graphic representation of the connections I have tried, I am not at all familiar with the scematics
of electronic circuits so excuse me if it will look weird. I show the simplest way i could think for the connection.
I have tried to give power to the servo not from the computer but from a seperate battery.
http://imageshack.us/photo/my-images/196/scematics.jpg/This is the scetch I have written in its simplest form.
73 is the value with which the particular servo stops
#include <Servo.h>
int sensorValue = 0;
int servoRightPin = 2;
Servo servoRight;
void setup()
{
servoRight.attach(servoRightPin);
Serial.begin(9600);
}
void loop()
{
sensorValue = analogRead(A5);
Serial.println(sensorValue);
if (sensorValue < 800){
servoRight.write(73);
delay(30);
}
else if (sensorValue > 800) {
servoRight.write(0);
delay(30);
}
}
Thank you again!