2 servos (or any functions) operating simultaneously?

void Servos digitalWrite.MegaServo( ) what's that?

   MegaServo MegaServo;

Having an instance name the same as the class name is not the brightest idea I've seen today.

AWOL:
If I knew, I could tell you.
At some point I had tried some random switching of terms, that's probably what that is a result of.
Correct me if I'm wrong. Your comment would imply that you can easily see or even know for certain that something is not right with that particular line of code. I'm fairly sure that's not the only error but if you would care to expand on your comment a bit and share some of the wisdom I am not privy to, I would more than appreciate being exposed to what you know about it.

PaulS:
I was thinking the same thing when I saw something similar in another code but figured I would give it a shot anyway.
While we are on the subject of luminescence, would you like to shed some light on why the idea is so dim? Maybe explain the conflict or possible conflicts? Can instance and class written structures be/look exactly the same? Could you suggest how it be done differently? What would you do in such a case? Does this even need to be done at all?

What I do know is that there is only one compiler error in the revision - an enormous improvement from the original in the playground where it is stated (in sum): just copy and paste, no changes necessary. I don't know who's smoking more of what on the playground but as you can see it clearly was not that simple. Unless of course there is some obvious step omitted that every programmer knows to be common knowledge while overlooking the inexperienced newbie who's yet to be a programmer.

Could you post a link to the Playground page where you found that please?

http://playground.arduino.cc//Code/MegaServo

Your comment would imply that you can easily see or even know for certain that something is not right with that particular line of code.

It isn't even like saying "My hovercraft is full of eels", a sentence that follows the rules of English syntax, but which makes very little sense.

void Servos digitalWrite.MegaServo( )

Here, we have the implication that we're looking at a function definition which doesn't return anything.
After that, my brain refuses to recognise what is going on.
I almost see a class name ("Servo"), a function name I recognise ("digitalWrite"), but with a structure field name ("MegaServo") I don't.

It's a bit like a Dali painting, expressed in C.

Afterthought Edit: In contrast, Duff's Device is more like an M.C. Escher print

"My hovercraft is full of eels", a sentence that follows the rules of English syntax, but which makes very little sense.

.....not true... makes perfect sense to Hungarians in tobacconists.

AWOL:
I can't say it makes or had made much sense to me either. That just happened to be my last fairly random guess at changing the statement before I posted the code. But, that's why I posted it, because I don't understand what was wrong with it in the first place before I tried a number of different combinations in order to at least get it to compile.

You already made it clear it doesn't make sense and this is what I already know as well, so further describing how it is senseless using simile is redundantly saying it again with a nice touch of sarcasm. Although it may help me realize how little I understand about programming in C++, it doesn't exactly help me get any closer to my goal of operating servos for a hexapod which is the reason for this thread.

I was hoping to gain insight into how this code could be corrected, rearranged or at least experimentally altered, or pointed in some useful direction that may lead towards a solution. A suggestion for a different approach, or as to how it might be changed, or added to, or parts to be removed would probably benefit my situation. If your brain refuses to recognize what is going on, it would seem that there is little motivating any investigation into the underlying issue/s with this code, and then I wonder, why bother.

Get rid of this:

   MegaServo MegaServo;

and the line that references it in setup.

Change this:

void Servos digitalWrite.MegaServo( )

to this:

void SetupServos( )

and call it from setup. That'll get you closer, though I didn't compile it, so it may be closer but with a new set of compiler error messages.

If your brain refuses to recognize what is going on, it would seem that there is little motivating any investigation into the underlying issue/s with this code, and then I wonder, why bother.

Because you asked me to.

if you would care to expand on your comment a bit and share some of the wisdom I am not privy to,
I would more than appreciate being exposed to what you know about it.

There was no sarcasm.
You'll just have to trust me on that.
You wouldn't like me when I'm sarcastic.

wildbill:

Thank you for your suggestions, I will try that and see what happens.

AWOL:

I can really only gather that you deem my attempts at composing a code I can use as hardly worth looking into. On the other hand I would have to consider my query as worthy of attention seeing as how there are over 2000 views of this thread. That would imply to me that there is a substantial number of people interested in the exact same information but who may be without the patience to be persistent in asking for help with it.
So when you get your dander up, do you shred your clothes and turn green? (just kidding) :grin:

seeing as how there are over 2000 views of this thread.

Some of us tuned in just to laugh.

PaulS:
What a knee slapper, glad I don't know what else you do for fun. I always thought I was amusing, either that or funny looking.
So when you're done wiping your chin, ya wanna post a USEFUL comment? Interject some information that is actually demonstrative of your programming prowess?
Judging from the cocky remarks, the hassle involved is too great and it's much easier to leave snappy critiques that generate that satisfying feeling of self aggrandizement.
Perhaps I was a bit presumptuous thinking I could come here, without any experience, for more than a spitting contest but to get help and learn a few things.
I wish I could say I appreciate all that you've offered here, Paul, my good buddy :wink:

Hi everbody,
I read posts but I couldnt figure out that can we run 2 servo (or multi function) at same time. (Note that; 2 servos (or more) will not work same degrees they will work different degrees simultaneously.) Does any body know anything?

Note:http://forum.arduino.cc/index.php/topic,118652.0.html
( I also checked above topic.Pauls says we cant.)

best regards

If you're asking "can I control two or more servos to the same or different positions simultaneously using the Servo library?" then the answer is "yes".

Thank you for reply. new questions
1.How?
2.Any example? (Pls note that: Servos will work whenever I want, (different positions, maybe different time...))

1.How?
2.Any example?

Four servos, independently and simultaneously.
(Uncompiled, untested)

const byte N_SERVOS = 4;
const byte servoPin [N_SERVOS] = {2, 3, 4, 5}; //whatever
Servo servo [N_SERVOS]; //simplistic controls on A0, A1...A(n-1)
void setup ()
{
  for (int i = 0; i < N_SERVOS; i++) {
    servo [i].attach (servoPin [i]);
  }
}

void loop ()
{
  for (int i = 0; i < N_SERVOS; i++) {
    servo [i].write (map (analogRead (i), 0, 1024, 0, 180));
  }
}

cengav4r:
Thank you for reply. new questions
1.How?
2.Any example? (Pls note that: Servos will work whenever I want, (different positions, maybe different time...))

http://forum.arduino.cc/index.php?topic=139121.msg1046613#msg1046613

AWOL and zoomkat thanks for reply.
To AWOL; Your codes works well,
To evolion; Your codes couldnt works fine at my system ( has 2 servos (even I entered serial to 30c,180b,70a,120d,)) , or I couldnt understand enough.(maybe it need different voltage sources)