Arduino/Servo Pan/Tilt: What pins?
2
answers
|
Answer it!
|
Here is pretty much everything you need:
http://arduino.cc/en/Tutorial/MotorKnob
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
Instead of 9 there could be varaible name and then you should find the variable definition somewhere before that ".attach" line. For example:
int servoPin1 = 8;
...
void setup()
{
...
servo1.attach(servoPin1);
...
}
Wiring a servo is as simple as that: red wire - positive voltage, black (brown) wire - ground, third color - signal wire, to the arduino pin that is stated in the code.
You can check wire colors here: http://www.bpesolutions.com/gadgets.ws/gprojects/servowg.gif .
But if you are using two bigger or any more tha two servos, concider providing them voltage from another source than arduino 5V pin. The grounds must be connected together (GND pin on arduino to breadboard servo-ground for example).
![]() |






























