Marko Timlin wrote:
Moi, does anybody know, if it is possible to control the Ping(ultrasonic range finder)sensor using only Pduino (first uploading Pd-firmware to the arduino, and then using the "arduino" pure data patch?). It doesn't work for me at the moment.
The Ping needs you to send a trigger and wait for an echo, and the delay needs to be precisely timed. Unfortunately pd can't communicate with the arduino or anything else outside the machine it's running on with enough timing precision to do that. (Sound travels about 1 foot per millisecond and the timing jitter with comport can be up to about 10ms, so your measurements will almost always be off by several feet.)
If I write my own ping-sensor-patch for arduino and then use the PD_inputs_to_PD patch it works fine.
Because the serial communication timing is not involved.
But I'd like to use several different sensors and it would therefore be much easier to just control all of them with Pduino and not writing new code for arduino all the time. Well, guess this was the original idea of Pduino anyways :-)
The code for many sensors is almost the same as the code for one sensor, so it shouldn't be too hard. If you must use Pduino, you could try one of the EZ1 sensors, it has an analog output that you can connect to an arduino analog in: http://www.hvwtech.com/products_view.asp?ProductID=560 I've used it with Pduino with no problems. I guess the other approach is to add modules to pduino that specifically handle specific hardware, but there is a _lot_ of hardware out there...the main ones that need doing are stepper motors (two or four pins have to change at the same time at precise times), servo motors (pulse width needs to be between 1 and 2 ms), and sonar sensors, as well as any hardware with a serial interface like servo controllers (serial data bits need to be accurately timed to about 2% of the data rate). Most everything else isn't as sensitive to timing.
Martin