Milestone met

Milestone- three motors at once
Today july 12 I have gotten all three of my motors to run from a simple program:

// Sweep
// by BARRAGAN
// This example code is in the public domain.

#include

Servo myservo1; // create servo object to control a servo
Servo myservo2;
Servo myservo3;
// a maximum of eight servo objects can be created

int pos = 0; // variable to store the servo position

void setup()
{
myservo1.attach(3,20,170); // attaches the servo on pin 3 to the servo object
myservo2.attach(5,20,170);
myservo3.attach(6,20,170);
}

void loop()
{
for(pos = 0; pos =1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo1.write(pos); // tell servo to go to position in variable ‘pos’
myservo2.write(pos);
myservo3.write(pos);
delay(15); // waits 15ms for the servo to reach the position
}

This code is the example sweep on the arduino I just added two more servo motors. Now I know that my wiring is correct and my motors should work once I connect them to the ps2 controller. This video explains more:

No Comments Yet.

Leave a reply