I am new here and just ordered the Arduino mega 2560. I recently got a BS in mechanical engineering but am lacking on the electrical side of things so I decided to get the arduino to start learning more. I have a project in mind that involves using 18 servos. I am going to slowly build up to the project starting with 1 servo and working up to getting all 18 functioning before I add any sensors or the like. Here is my issue. On looking for documentation on how to use a servo on the arduino board I found these two:
Both of which have generally the same steps and code. The part I am confused on is one of them attaches the control wire of the servo to a digital PWM I/O pin (Pin 9 in example I beliveve) while the other attach is to a analog I/O pin. Would either of these work or is there a difference in the servo being used as I know there are also digital servo vs. analog servos.
I just want to make sure. I would ave just tested this but I dont have my arduino yet. I am planning on using analog servos due to the reduced cost of them over digital servos. Hopefully someone can tell me which of these two methods will work or if either will work. I am hoping either will work due to the mega2560 only having 16 analog pins where as I need 18 servos.
Thanks for any help you can provide. P.S. I apologize if this is in the wrong place I wasn't sure where to put it.
But in the example the servo control in plugged into the analog in pin 2. It is this way both in the text and the picture. I am assuming by your comment that this is in fact wrong. So I would need to plug the servos into the digital I/O pins instead. Would I have to use the PWM digital pins or just the standard digital pins if I want to control the servo position. Sorry to bother you with these questions I am just really new to using this hardware and software. Thanks again!