Yes it was pretty easy! Line #13, instead of char packetBuffer[PACKET_SIZE]; the correct one is byte packetBuffer[PACKET_SIZE];
Anyway, I still can't understand why there's a misunderstanding between MAX and the Arduino.
This is my "new" arduino code
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUPD.h>
#define localPort 7401
#define BUFFER_SIZE 12
byte mac[] = {0x90, 0xA2, 0xD3, 0xE0, 0x66};
IPAddress ip(192, 168, 1, 177);
byte packetBuffer[BUFFER_SIZE];
EthernetUDP Udp;
void setup()
{
Ethernet.begin(mac, ip);
Serial.begin(9600);
Udp.begin(localPort);
}
void loop()
{
if (Udp.parsePacket() > 0)
{
Udp.read(packetBuffer, BUFFER_SIZE);
for (int i = 0; i < BUFFER_SIZE; i++)
{
Serial.print(packetBuffer[i]);
if (i < 11)
Serial.print(", ");
else
Serial.println(".");
}
}
}
What I obtain is:
105, 110, 116, 0, 44, 105, 0, 0, 0, 0, 0, number. (number is what MAX sends)
The values before "number" never change
If I add the line - Serial.println(Udp.parsePacket()); - after line#23 I obtain:
0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.
I don't know if you're good with MAX (I am not, these are the very first sketch I make) but I will upload the "code"
Also this is pretty easy and I can't see mistakes or something.
Need help! Thanks