Ping Robo code error

I'll just merge together these two threads of yours:

  • Ping Robo code error
  • Code Error :- Ping Robot

Clever attempt to slip cross posting past us by changing the word order.

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

  • Moderator

I redesigned my ping code but i still have the same problem that my servos are rotating in opposite direction.

Normally on a two wheeled robot, that would be a good thing - what configuration have you got that makes it a problem?

That aside, if you want them to rotate the same way, use the same number of degrees on the paired writes, not 0 & 180.

If you send forward command to both servos, they will run forward, BUT because I assume one is turned over/around with respect to the other, it will appear to be running in the opposite direction.
SO to get foward movement you will need to send forward for the first motor and reverse for second other.
Reverse movement will be reverse for first motor and forward for the second.
Just a thought, inspired by wildbills comment.
Tom.

TomGeorge:
SO to get foward movement you will need to send forward for the first motor and reverse for second other.
Reverse movement will be reverse for first motor and forward for the second.
Just a thought, inspired by wildbills comment.
Tom.

What u meant by forward movement? Are you referring to changing degrees ? Like 180 in one and 0 in other..

Can you describe your drive system?
What do the servos turn?

AWOL:
Can you describe your drive system?
What do the servos turn?

I have wheels attached to my servos. These ones :- Pololu - 2-5/8" Plastic Red Wheel Futaba Servo Hub

So are these the so-called "continuous rotation" servos?

Why didn't you say so?

AWOL:
So are these the so-called "continuous rotation" servos?

Why didn't you say so?

Ofcourse these are. Its obvious that if im making a robot then those will be continuous servos.

Its obvious that if im making a robot then those will be continuous servos.

Of course, it's not obvious at all; they could be (real) steering servos, or (real) servos driving mechanical speed controllers, or (real) arm/joint servos.

So, you've got a pair of opposed ex-servos, right?
You're able to command them to rotate in either direction?

AWOL:

So, you've got a pair of opposed ex-servos, right?
You're able to command them to rotate in either direction?

Im not intentionally commanding them to rotate in either direction. They are just rotating by themselves and also my ping only show reading in serial monitor and does work in controlling servos. Plzz help bro.

Have you written a simple sketch that commands the ex-servos to rotate and stop the ex-servos?
Forget the sonar for now.
Do you know how to stop the servos rotating?

AWOL:
Do you know how to stop the servos rotating?

Yes, you can stop continuos servos by assigning them degree 90.

Yes, you can stop continuos servos by assigning them degree 90.

No, I can't, because I don't have your ex-servos.
Are you able to stop the ex-servos rotating?

Cant understand ex-servos and no im not able to. Can u please tell me if im right in stopping them by assigning their degree 90 ?

Cant understand ex-servos

They're not servos because they can't be commanded to a target "angle", so they're almost certainly ex-servos.

Can u please tell me if im right in stopping them by assigning their degree 90

It may be 90 "degrees", it may be 89, or 86... it depends on the ex-servo and how it was butchered.

You can find the stopping point by trial and error. Zoomkat may be along shortly with some code that may help you find the stopping "angle" or pulse timing.

Im just finding a solution for my servos which are rotating in either direction. Im not here for stopping my servos.

OK.

Are you able to command the ex-servos to rotate in a direction of your choice?
If you write, say, 135, do they rotate in the opposite direction to when you write 45?

Have you got the grounds connected?

AWOL:
OK.

Are you able to command the ex-servos to rotate in a direction of your choice?
If you write, say, 135, do they rotate in the opposite direction to when you write 45?

Have you got the grounds connected?

No, thats my problem that they are rotating in opposite direction. and ofcourse i have the grounds connected.

Please, there is no "of course" about any of this.
Have you tried the "sweep" sketch to see if a single ex-servo can be commanded to rotate first in one direction and then in the other?

Do you think that my servos are defective thats why they are not working?