Go Down

Topic: PING)) Sensors.. Communication Help (Read 1 time) previous topic - next topic

husein06


I don't think there is an actual way, because all motors/servos are not the same. Unless you code it yourself with set ranges (between 5 - 12 inches, turn this much) that's what I did for my robot.


Did you do a similar project?... But how will it know how much to turn, for example if its 5 inches or 50 inches?

And, I did not figure out how to use both sensors at once, going back to my first question, it didnt work, it only shows me one sensor!

husein06


try this:

(duration1, duration) = pulseIn((pingPin2,pingPin), HIGH);         


It didn't work!

PeterH

#7
Dec 28, 2012, 11:44 am Last Edit: Dec 28, 2012, 11:51 am by PeterH Reason: 1


try this:

(duration1, duration) = pulseIn((pingPin2,pingPin), HIGH);          


It didn't work!


Well of course it didn't work! It was complete nonsense.

I don't understand what you're trying to achieve or how multiple ping sensors helps you achieve it. Are you trying to detect obstacles in multiple directions, or something? If so, the easiest way to read from multiple receivers is to pretend you have one sender and one receiver and do one 'ping' in the usual way, then do exactly the same thing with the sender and the other receiver. This means you will send out a separate ping for each receiver, but I don't see any harm in that.

The alternative is to use a completely different method to get the response from the receiver, which enables you to receive from two inputs simultaneously. That's going to be much harder to do, and is not the approach I'd recommend. But if you have a remote sender and you're trying to use stereo receivers to determine the direction to the source, then you will need to read them both simultaneously to see which one receives the pulse first. In this case the exact timing might not matter (you can't determine range unless you know when the pulse was sent) and all you'd care about was which receiver picked the pulse up first. I suspect you could do that using interrupts and direct port access to grab the state of both inputs with minimal latency, but it's going to need an approach that's very different to the conventional ping range finder.
I only provide help via the forum - please do not contact me for private consultancy.

HazardsMind

Sorry about that I kinda figured it would work being that arduino has port manipulation. I thought it would be able to read and write to multiple pins that way, but NO. Yea go with normal method of just getting the data from one at a time.

It should be made into a new feature. It would be so much easier access multiple pins, if it were possible.
Created Libraries:
TFT_Extension, OneWireKeypad, SerialServo, (UPD)WiiClassicController, VWID

PeterH


Sorry about that I kinda figured it would work being that arduino has port manipulation. I thought it would be able to read and write to multiple pins that way, but NO. Yea go with normal method of just getting the data from one at a time.

It should be made into a new feature. It would be so much easier access multiple pins, if it were possible.

It is possible to read and write to multiple ports simultaneously, but it requires direct access to the port registers rather than inventing a new language syntax. When you access the port registers directly you lose the benefits of the high level functions provided by Arduino, so it's the sort of thing you only want to do when really necessary. Trying to detect very small timing differences between inputs on different pins might be one of those situations where it was necessary.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up