Go Down

Topic: Need some help for a science project. (Read 10 times) previous topic - next topic

Falchion

I don't understand how to add multiple servos to the breadboard... I read this tutorial (http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html),and I don't get how he added the last 4(?) servos towards the end. I did Sweep on the Arduino UNO, but I don't think there are enough ports on it to support many servos at once. Can I get some help?  :(
Robots are cool.

PaulS

Quote
I did Sweep on the Arduino UNO, but I don't think there are enough ports on it to support many servos at once.

A port consists of 8 pins. It only takes one pin to drive a servo. The UNO has more than enough pins to drive 4 servos.

JimboZA

#52
Jan 21, 2013, 04:15 am Last Edit: Jan 21, 2013, 04:17 am by JimboZA Reason: 1
Quote
I don't get how he added the last 4(?) servos


Well you only need one pin per servo for control remember, the power being taken care of off the Arduino. Let's say you have the following lines in your code (extract from sweep):

Code: [Select]
Servo myservo;

myservo.attach(9);

myservo.write(pos);


You could have this (incomplete code!) for three servos:

Code: [Select]
Servo myservo;
Servo myotherservo;  // <<<< note new names; you would call these "thumb", "middlefinger" maybe
Servo yetanotherservo;

myservo.attach(9)
myotherservo.attach(10)  // <<<<<<< note the new pin numbers for the yellow / orange control wire
yetanotherservo.attach(11)

myservo.write(pos);

myotherservo.write(pos);

yetanotherservo.write(pos);


So how did you get on yesterday?- Did you get one finger clenching and unclenching?

Quote
What is that cord on the battery holder called? I really need one.


No idea
Roy from ITCrowd: Have you tried turning it off an on again?
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Falchion

I'm on step 3 of this tutorial (http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html) and the servo doesn't move when I upload the sketch. Can I get some help?
Robots are cool.

Quick5pnt0


I'm on step 3 of this tutorial (http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html) and the servo doesn't move when I upload the sketch. Can I get some help?


Post your sketch and a picture of your wiring.

Go Up