Go Down

Topic: Multiple servo motor with using arduino code! (Read 1 time) previous topic - next topic

akira8792

I'd like to use an arduino to control 2 servos.  I have found a single servo motor code but i coudnt find it multiple servo code.

i tryin to make a 4 different angle (0, 90, 180, 360 dgrees) with one of servo motor and other servo is 8 different angles  (0, 45, 90, 135, 180, 225, 270, 360 dgrees).

Please help me to make the code plesase.



akira8792


this is the i made a sing servo motor code.

// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

#include <Servo.h>

Servo myservo;  // create servo object to control a servo


void setup()
{
 myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop()
{
  myservo.write(10);                  // sets the servo position according to the scaled value
 delay(1000);                           // waits for the servo to get there
    myservo.write(90);                  // sets the servo position according to the scaled value
 delay(1000);                           // waits for the servo to get there
    myservo.write(180);                  // sets the servo position according to the scaled value
 delay(1000);                           // waits for the servo to get there
    myservo.write(360);                  // sets the servo position according to the scaled value
 delay(1000);                           // waits for the servo to get there
}


mem

#2
Apr 15, 2010, 03:59 am Last Edit: Apr 15, 2010, 05:37 am by mem Reason: 1
Standard hobby servos will not rotate more than 180 degrees (many will rotate a somewhat less than this)

What are you trying to make?

akira8792

i tryin to make a toy for uni project.

do you know about any coding stuff?

connects to the 2 servos into arduino

mem

if you need 360 degree rotation then you may be better of using a stepper motor.

Can you describe what you want this toy to do?

Groove

Quote
I have found a single servo motor code but i coudnt find it multiple servo code.


Really? Did you look in the Playground?
Per Arduino ad Astra

th3im2ortal

hi God members, i am doing same project with him. And we want 1 servo to spin at random angles (0,45, 90,135,180) for 1-4s, and another servo to spin at (0,45,90,135,180)

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy