0

I am trying to send from max msp some values. I have no problem in receiving them however, when I try to send multiple values at one I have some troubles. Is there a way to get multiple values?

enter image description here

using the code below I am getting :

> pixelNum: 10 pixelState: 0 pixelNum: 1 pixelState: 0

void loop() {

  OSCMessage msgIN;
  int size;
  if((size = Udp.parsePacket())>0){
    while(size--)
      msgIN.fill(Udp.read());
    if(!msgIN.hasError()){
      msgIN.route("/pixelAni",pixelAni);
    }
  }
}

void pixelAni(OSCMessage &msg, int addrOffset){

  int pixelNum = msg.getInt(0);
  int pixelState = msg.getInt(1);

  Serial.println("pixelNum: ");
  Serial.println(pixelNum);
  Serial.println("pixelState: ");
  Serial.println(pixelState);

  pixels[pixelNum].R = 255;
  pixels[pixelNum].G = 255;
  pixels[pixelNum].B = 255;

  ledstrip.show(pixels);
}
SNos
  • 3,430
  • 5
  • 42
  • 92

1 Answers1

0

So many options! The simplest would be the pack object, when it receives an input to its left most inlet it will output. Since max data flows Top to Bottom and Right to Left, this should gaurantee that you allways output both numbers

You could use the buddy or thresh objects to sync up the messages if you cant guarntee they arrive at exactly the same time

Rampartisan
  • 427
  • 6
  • 19