I see how this could work for the flexibility you want... your setup code would initialize all of your pins, and you could have it wait for a message from Pd in the loop to tell it which devices are used on which set of pins. Then, it's just a matter of reseting the arduino and sending it a message when you want to change the setup.
I haven't tried changing pin mode in the loop before. I've only done it in the setup. If you can change the pin modes in the loop, you could be much more flexible too.
Chuck
On Dec 24, 2007 6:47 AM, Marko Timlin susi@timlin.de wrote:
Hi Marius, you are absolutely right! After writing code for the arduino I can use the Ping sensor without any problems within PD (using the PD_inputs_to_PD patch). But that is not my problem. My problem is that if I work like that, I have to change the arduino code all the time I change my sensor setup. Like for instance: First I write arduino code for 3 Ping sensors and 3 solar panles...but then I want to use 4 Ping sensors with let's say 3 LEds. It would be great if I could do all that using only the arduino patch in PD, without writing new code for arduino all the time. Of course after uploading the Pd_firmware onto the arduino-board. Any idea how? And at the moment I would like to work with 8 Ping sensors :-) and 5 solar panels at the same time.
Best, Marko
hmm, I think arduino can handle the ping range finder. but you need to write your specific code. use a code that you find online (the routine is something like: turn pin to outlet, set pin high, wait some milliseconds, set pin low, turn pin to inlet, measure the time until you receive the echo...) and then send the value to pd via serial port (115200). then measure next value. I think, you should be able to send at least 20 values per second, but that is a guess. do you need more info for the arduino code? how many sensors do you have? marius.
it is
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.
If I write my own ping-sensor-patch for arduino and then use the
PD_inputs_to_PD patch it works fine.
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 :-)
MArko
PD-list@iem.at mailing list UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list