Hello everybody, I've created a new topic a couple of weeks ago in the Software section of the forum to ask about the problem I'm going to exhibit right now. I think that asking again here will be better since the problem is (probably) not about the Arduino and it's code but MAX/MSP.
This is a prntscreen of the MAX sketch I've made
Pretty simple stuff, it collects 3 bytes generated randomly by 3 different "drunk" functions and send them via UDP to the Arduino.
This is the Arduino code
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>#define localPort 7400
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xE5};
IPAddress ip(192, 168, 1, 177);EthernetUDP Udp;
int PACKET_SIZE = 0;
void setup()
{
Serial.begin(9600);
Ethernet.begin(mac, ip);
Udp.begin(localPort);
}void loop()
{
PACKET_SIZE = Udp.parsePacket();
byte packetBuffer[PACKET_SIZE];if (PACKET_SIZE > 0)
{
Udp.read(packetBuffer, PACKET_SIZE);for (int i = 0; i <PACKET_SIZE; i++)
{
Serial.print(packetBuffer*);*
- if (i < (PACKET_SIZE - 1))*
- Serial.print(", ");*
- else*
- Serial.println(".");*
- }*
- }*
}[/quote]
Easy, it prints unto the serial monitor the data recevied via UDP by MAX/MSP. The problem is here...
I should receive only 3 bytes, I can't understand why I get 28! Also - the correct ones - are the 20th, 24th and 28th. Seems like the others are something that comes from MAX/MSP but I don't know why and I don't know how to avoid this problem. I'm looking for some help, hope you'll enlighten me guys!
Thanks for your tips!
EDIT: I've just discovered something cool, the first 4 bytes (108, 105, 115, 116) compose the word "list", could this help?