WiDi UDP library with touchOSC [Solved]

Ok, I just understood what the binary data are. It correspond to the ANSI language... Can I convert it to get a number ? And print it ?

Yes, but...

You knew there was going to be a but, right?

You need to look at the format of an OSC message. There can be more than one binary value included in the packet. Something, somewhere, in the packet defines how many values there are, and the type(s) of values.

For that one message, you could use a union and store 4 bytes in the byte part, and print the float part.

union stuff
{
   byte b[4];
   float f;
};

union stuff oscValue;

oscValue.b[0] = ???;
oscValue.b[1] = ???;
oscValue.b[2] = ???;
oscValue.b[3] = ???;

Serial.print(oscValue.f);

The ??? are to be replaced with elements from the packet. Which ones? You'll need to experiment to determine that. Clearly, nothing from the first 10 bytes. Try consecutive sets of bytes, starting with packetBuffer[10]. Run the code. Compare what you print to what you sent. If they match, great. If not, move up to start with 11, 12, etc. until you get something that looks right.

It works ! I can get the value !

Thanks your very much !

It works ! I can get the value !

Thanks your very much !

You're welcome. Perhaps you could post the code you came up with, so others can benefit.

PaulS:

It works ! I can get the value !

Thanks your very much !

You're welcome. Perhaps you could post the code you came up with, so others can benefit.

Good trick with the union. I need to remember that as the syntax is simpler to understand than setting up an array of pointers pointing to another variable's lvalue...

maisseb:
First of all, thanks for your help !

PaulS:

The Arduino WiFi Shield library is the only library which work with the WiFi Shield. So the only solution is to try with this library, but I didn't found the transfer mechanism on it...

The WiFi library establishes the connection between the Arduino and the PC.

The UDP library manages the transfer of packets. It doesn't give a rats ass what's in the packet.

You've got a packet that contains some data that you don't know how to process. Why not look for a library that does know? The one that Sembazuru mentions bears looking at.

I agree with you, but the data is not received on the WiFi Shield and on the Ethernet Shield with the same protocol, and with the last Arduino library (which is the only one including Udp exploitation), all files are like "merged", they works together. That's why I'm not able to import an Ethernet library (modified) to work with the WiFi Shield, and on the link that Sembazuru sent (thanks to you) we can see here touchOSC | CNMAT that all files are build to work with Ethernet...

I'm starting to go round in circles because of I'm not familiar with exploitation and the modification of open transmission libraries. And don't find much support and examples for this Shield :frowning:

It is true that the UDP examples we included in the first OSC for Arduino library release use the Standard ethernet library but we carefully factored the OSC handling itself to be independent of the transport protocol. It should be easy to adapt to any I/O that uses the Stream class.