Go Down

Topic: arduino uno & max msp connection (Read 2 times) previous topic - next topic

uno11

hi
How to connect  analog sensors sharp GP2Y0A21YK+ arduino uno + MaxMSP ?




dxw00d

Some wires between the sensor and the Arduino, and a USB cable from the Arduino to the PC.

uno11

which can I use the example in arduino software ? ( for max test analog freq ) and Is there a sample max msp patch ?

dxw00d

I don't know. Where have you looked? Did you try searching this site? Did you try google or bing or whatever search site you use?

Try here http://arduino.cc/playground/Interfacing/MaxMSP for a start.

uno11

i downloaded arduino 2 max but Error adding cod is pde on arduino software ( serial BYTE )

http://f1203.hizliresim.com/v/y/3y3qb.png



dxw00d

The error message is quite descriptive. Find the Serial.print() statement containing the BYTE keyword and replace it with a Serial.write() instead.

uno11

how can i Find the my Serial.print() ? sorry i beginner user 

dxw00d

You could try Edit>Find... in the IDE, or you could just look for it.

uno11

my arduino max pde :


/* 
*  Arduino2Max
*  Send pin values from Arduino to MAX/MSP

*  Arduino2Max.pde
*  ------------ 
*  This version: .5, November 29, 2010
*  ------------
*  Copyleft: use as you like
*  by Daniel Jolliffe
*  Based on a sketch and patch by Thomas Ouellet Fredericks  tof.danslchamp.org

*/


int x = 0;                              // a place to hold pin values
int ledpin = 13;

void setup()
{
  Serial.begin(115200);               // 115200 is the default Arduino Bluetooth speed
  digitalWrite(13,HIGH);              ///startup blink
  delay(600);
  digitalWrite(13,LOW);
  pinMode(13,INPUT);
}



void loop()
{

if (Serial.available() > 0){         // Check serial buffer for characters
       
    if (Serial.read() == 'r') {       // If an 'r' is received then read the pins
   
for (int pin= 0; pin<=5; pin++){      // Read and send analog pins 0-5
    x = analogRead(pin);
    sendValue (x);
    }



for (int pin= 2; pin<=13; pin++){     // Read and send digital pins 2-13
    x = digitalRead(pin);
    sendValue (x);
    }
 
    Serial.println();                 // Send a carriage returnt to mark end of pin data.
    delay (5);                        // add a delay to prevent crashing/overloading of the serial port
 
  }

}
}

void sendValue (int x){              // function to send the pin value followed by a "space".
Serial.print(x);
Serial.print(32, BYTE);
}


uno11

please can you put them cod and save give me please cod ? because i don't find I do not know what to do thanks

dxw00d

There is one occurrence of a Serial.print() with the BYTE keyword in it.

Replace it with
Code: [Select]
Serial.write(32);

uno11

ok done compling thanks, but after clicked I run max msp and (Arduino2MaxNovember2010_V.5) patch. toggle click COM 2 how can i do that now because my sensor is does not eork right now ?


uno11

i changed com 2 to bluethoot pda sync  and analog input ra0 ra1 ra2 ra3 ra4 ra5 its is work very fast number changes. is it connect arduino to max ? ( my sensor put on the ardunio analog signal A1 )


dxw00d

Does your Arduino have Bluetooth?

I don't know anything about Max.

uno11


Go Up