Input servo commands

I've been coding for a few months but I'm new to the Arduino world and I appreciate any help I can get. I have 5-10 servo motors set up in a line that I want to rise and fall sequentially, starting with the 1st and ending with the last, like a traveling wave. And I want the servos to do this for several minutes. Ideally I would write a program with microinstructions telling one servo to rotate back and forth, and a delay for how much time each movement should take. For example...

myservo.move(180, 0.5) myservo.move(177, 0.3) myservo.move(172, 0.8)

where first int is degrees and second is time delay. I would send the tailing servos the same exact commands as above, but they would carry them out maybe a second or two after the first servo to create the wave (depending on the distance between the servos).

I read up on the writeMicroseconds() code for servos but I haven't gotten it to work the way I want just yet. If you can help me at all I'd be very thankful!

Sam

You probably post up the code you have that doesn't work so it can be evaluated. Have you gotten a single servo to perform a wave movement?

I used this code as a base:

#include <Servo.h>

Servo myservo;

void setup()
{
myservo.attach(9);
myservo.write(90); // set servo to mid-point
}

void loop() {}

I got that code to work but I want to do something like this:

#include <Servo.h>

Servo myservo;

void setup()
{
myservo.attach(9);
myservo.write(100);
delay(10);
myservo.write(110);
delay(5);
myservo.write(115);
delay(15);
myservo.write(120);
}

void loop() {}

I got the servos to do basic stuff like sweep and receive input from a potentiometer but to better phrase my question: how should I input hundreds or maybe thousands of incremental steps for these servos to carry out quickly in a few minutes? I could either write it into the program textually, that might take a while but that’s how I was planning on doing it? or it could be easier to write a program for example to record all the minuscule changes received from a potentiometer over a few minutes, copy the increments and delays and send the info to the servo to begin moving exactly when I want it to. I hope that all makes sense. Anyway I would probably be repeating the same instruction and the same code over and over again and maybe someone could identify syntactically what commands or code I might use to input for these servos. thanks much.

sorry to sound like a noob.

I am not sure exactly what you are wanting to do, but I would bet that most of your problem could be solved by using an array.

#include <Servo.h>

Servo myservo;

void setup()
{
myservo.attach(9);
myservo.write(90); // set servo to mid-point
delay(1200);
myservo.write(110);
delay(1000);
myservo.write(140);
delay(1500);
myservo.write(170);
}

void loop() {}

This code works but delay is the amount of time between servo movements. What I actually want to do is tell the servos how long to take to get to each position, with no delay in between… Does anybody know how to do that? Sorry for the confusion.

The below might be of interest and worth trying. Also, you should put your code inside code tags (the # on the tool bar above the post you are making) to ensure it is displayed correctly.

http://arduino.cc/en/Tutorial/Sweep