Interfacing Arduino with Max/MSP + Jitter? Help!

Hi,

I've been on a couple of times asking about some similar stuff but now I am well and truly stuck.

[u]I just simply need Arduino to send numbers to Max/MSP. That's it, I know it might sound like a novice question but does anybody here know how to do it? Basically I just need to send numbers from Arduino to Max/MSP that will trigger a "BANG" which will get a video and audio to start playing. Is there certain objects within Max/MSP that I need?[/u]

I will be using a heart rate monitor at a later stage of the project but for now I am just using a switch to simulate the heart beats. So the project will, hopefully in the end, take the BPM of my user and will trigger different sounds and video's to play based on the fluctuations in the users' heart rate.

Anyway here is the code that I am using at the moment to simulate the heart beats. It still needs a bit of work [u]but again, it is the interfacing with Max/MSP that I am having trouble with.[/u]

int inPin = 7;         // the number of the input pin
int ledPin1 = 13;
int reading;           // the current reading from the input pin
int previous = LOW;    // the previous reading from the input pin
int count=0; //number of times button was pressed

// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0;         // the last time the output pin was toggled
long t;
long x;
long y;
long debounce = 200;   // the debounce time, increase if the output flickers

void setup()
{
  
  pinMode(ledPin1, OUTPUT);
  pinMode(inPin, INPUT);
  
  
  Serial.begin(9600);
}

void loop()
{
  reading = digitalRead(inPin);
  

  // if we just pressed the button (i.e. the input went from LOW to HIGH),
  // and we've waited long enough since the last press to ignore any noise...  
  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
    //increment count
    count++;

    // ... and remember when the last button press was
    time = millis();
   
    x = time;
    
    y = t - x;

    Serial.print("\n The time betewen button presses =  " );                      
    Serial.println(y);
    
    Serial.print("\n Count =  " );                      
    Serial.println(count);
   // time = 0;
    
  }
  previous = reading;

  if (count==10)
  {
    digitalWrite(ledPin1, HIGH);
    count=0; //reset count
  }

}

Thanks in advance

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1269301258 maybe?

The best and simplest way to interface Arduino with Max/MSP is by using the serial object. There is a great tutorial on this site:

http://www.underwater.ca/blog/arduino-to-max-msp

You can also download a custom built serial max patch and arduino sketch from that link as well.