On 2012-11-25 15:12, onyx@onyx-ashanti.com wrote:
On Sun, Nov 25, 2012 at 8:13 PM, Martin Peach <martin.peach@sympatico.ca mailto:martin.peach@sympatico.ca> wrote:
I don't understand what you mean by the "arduino object". As I understand it you have a RN-XV plugged into an Arduino using an xbee shield. The RN-XV makes a wifi connection to your PC via a router, and you want to use that connection to communicate with the Arduino. The Arduino itself talks to the RN-XV using its serial port. Is that correct?
yes. it communicates on pins 2 and 3 of the rn-xv. that part works. it connects to the router. the arduino object is the pduino object in pure data. it interprets the data coming from the arduino. from looking at the inside of the patch, it seems that what the arduino is sending and what the abstraction [pd command processing] inside the [arduino] object, is interpreting, are the same thing so i guess i am wondering if the serial protocol is neccessary to link the two (firmata formatted tcp stream coming from the arduino and a firmata formatted [route] that seems to have every named input stream that is coming from the arduino). and if not, which object, that doesnt use serial,would allow this tcp (or udp) bi-directional conduit?
im not married to deleting the comport but i would like to see if it works because the whole system might work better.
You could use a WiFi shield with Arduino and use the arduino wifi library. That takes care of all the internet Protocol stuff and leaves you with the raw data just like a serial connection, except the data arrives in chunks. At the Pd end you could then use [netsend] and [netreceive], or the net objects like [tcpclient] and [udpsend]. As it stands you have a wifi module that handles all the packetization itself and transfers the data through an asynchronous serial link to the Arduino. The wifi shield hardware exchanges data with the Arduino using SPI, which is a clocked serial protocol that runs a lot faster (around 1000000 baud) than asynchronous serial. So I think the bottleneck is between the RN-XV and the Arduino. A WiFi shield would be faster. You could use [udpsend] and [udpreceive] instead of [comport] with either setup, but the Arduino program would be different (depending on how each module expects to be told the destination IP address/port, as well as the data being sent/received using different methods). At the Pd side, [udpsend] and [udpreceive] are the same as [comport] as far as data in/out but [netsend] expects messages terminated by semicolons.
Martin