Datasheet
Finding out where you are
Another great thing about feedback is: You don't need to write code to remember the last
position command you sent to the servo (assuming it got there). If you want to find out what
position your servo is in, you can simply ask it!
Once you have calibrated your servo with the calibration function above, this bit of code will tell
you the current position (in degrees) of your servo:
The ability to simply read the servo position opens up the possibility of using it as an input
device as well. The next page will show you how.
while(abs(analogRead(analogPin) - target) > tolerance){} // wait...
}
int getPos(int analogPin)
{
return map(analogRead(analogPin), minFeedback, maxFeedback, minDegrees, maxDegrees);
}
© Adafruit Industries http://learn.adafruit.com/analog-feedback-servos Page 9 of 12