help with arduino multiple messages


    Jul 06 2011 | 8:43 pm
    Hi,
    I been banging my head trying to figure it out how to get
    max msp to unpack 2 sensors data.
    here is my max patch fallow by arduino stech.
    any help is welcome
    +++++++++++++++++++++++++++++++++++
    arduino code
    ========================
    int potPin = 5; // select the input pin for the potentiometer
    int potpin2 = 2;
    int ledPin = 13; // select the pin for the LED
    int val = 0; // variable to store the value coming from the sensor
    int val2 =0;
    void setup() {
    Serial.begin(57600);
    }
    void loop() {
    val2 = analogRead(potpin2);
    val = analogRead(potPin); // read the value from the sensor
    Serial.println(val);
    delay (10);
    Serial.println(val2);
    delay (10);
    }

    • Jul 06 2011 | 10:56 pm
      You can add an index before the value in your arduino script :
      Serial.print("1 ");
      Serial.println(val);
      and respectively :
      Serial.print("2 ");
      Serial.println(val2);
      and in your max patch you add a route object:
      jan
    • Jul 06 2011 | 11:10 pm
      Or you could use Jan's method of a Serial.print followed by a Serial.prinln to put both values in the same serial message and then use unpack to get the results in Max.
    • Jul 13 2011 | 12:26 am
      looks like it works.
      thanks guys