int packetSize = Udp.parsePacket();
if (packetSize)
{
Serial.print("The incoming packet is ");
Serial.print(packetSize);
Serial.println(" bytes long");
packetSize isn't a boolean, and shouldn't be used like one. If you want to do something only when packetSize is greater than 0, make that explicit.
- why if I send a string (I use MAX/MSP to do so) composed by the characters "abcde" (with no " obviously) the Arduino says that the string is 12 bytes long? That's not true , it should be 5 bytes long unless I'm missing something.
If you printed the string you receive properly, I think you'll see the issue.
Serial.print("Packet contents: [");
Serial.print(packetBuffer, PACKET_SIZE);
Serial.println("]");
If there are extra characters between the [ and ], and I suspect that there will be, then Max is adding padding.
- I'd like to send bytes/integer numbers instead of strings but I can't because when I do so (i.e. I send the number 255 with MAX) I obtain the following message: It contains the following characters: int
Certainly not an Arduino problem. Something is wrong in your Max code.
For the 2nd I probably need to create a new function into the EthernetUDP class
How you intent to make the sent value out of the string "int" I have no idea.