I was having the same issue, no real movement of the servo until I grounded the power supply to the Arduino. Can you explain why this is needed? Does this provide a loop back for the output from pin 9?Correct, current onlly flows in a loop, so output pin, through servo control input pin, out servo ground, back to arduino ground.Also, I am not getting exact control. When I say write(90), it goes further than 90, probably 100. When I say write(180), the servo tries to go beyond 180 and sits there rattling!? The servo library is a little brain dead as it makes assumptions about the specific servo you are using that may or may not be true. Not all servos can physical travel 180 degrees. A good way to test your specific servo's travel range is to use servo.writeMicroseconds(xxxx) command where xxxx = 1500 for the center of travel, xxxx = 1000 to 2000 is 'guaranteed' for most all servos but most have some under and over range that accounts for the total travel range possible before hitting mechanical stops on the gear train. The servo library assumes physical end points of 544 and 2400. Test for your end of ranges and you will know how many degrees are possible for your servo.I am new to servo control and have Googled all over. Any pointers to some good pointers is appreciated.ThanksKevin
I see the comments at the top of the code say you should perhaps NOT connect the servo to the Arduino's 5V. I'd try with its own supply, as shown attached. Make sure to connect the grounds.