This doesn't work. As I mentioned have to increment/decrement from 'current position' by 1.
So servo2.write(0) won't work if the rotor is at some other angle say 30degrees.
If the rotor was at 0 degrees again servo2.write(100) won't work as it has to be incremented repeatedly by 1 till it reaches 100.
The data sheet for that servo shows 500mA run current, stall current of 2.5A at 6.0V power supply. A fresh set of 4 AA alkaline batteries should work for a short amount of time, no way will it run off a 9V battery, particularly when fed through the voltage regulator on the UNO.
@UKHeliBob@jremington I am posting on arduino forum for the first time. Wondering if all can see all the conversation - as I posted quite a bit in detail - and answering every post of anyone trying to help - but was surprised to see your comments that details are not there. Apologies for that , but frankly don't know what additional info can be given. May be because all the information is quite distributed and confusing. Thanks a lot for your comments , diagrams and for helping so far.
I use this simple test sketch for calibrating servos with Nano / UNO, type in angles in microseconds (500 ~ 2480) in Serial monitor entry box and press [ENTER] or click SEND button.
// servoCalTest.ino
#include <Servo.h>
Servo servo;
int
zeroVal = 500,
centerVal = 1490,
maxVal = 2480;
byte cntr = 9;
void setup()
{
Serial.begin(9600); // set serial monitor line ending to Newline
servo.write(centerVal);
servo.attach(9,zeroVal,maxVal);
}
void loop()
{
// if there's any serial available, read it:
while (Serial.available() > 0)
{
// look for the next valid integer in the incoming serial stream:
int pos = Serial.parseInt();
// look for the newline. That's the end of your sentence:
if (Serial.read() == '\n') {} // skip 1 second wait
//pos = constrain(pos,0,2500);
servo.write(pos);
if(++cntr >= 8) // print header
{
Serial.println("degrees microseconds");
cntr = 0;
}
Serial.print(servo.read());Serial.print("\t\t");
Serial.println(servo.readMicroseconds());
}
}