Communicating from Arduino to Max/MSP via XBee Series 1


I have been successfully communicating from Arduino to Max/MSP via Xbee Series 1 radios using a very simple code that reads sensor values from analogue pin 0 and sends them to a MaxPatch. Baud rate is set at 9600 with no issues.

Now, I’m trying to run Arduino code and MaxPatch written by Andrew Benson and downloaded from here: It reads multiple Arduino digital and analogue pins and sends them to a corresponding MaxPatch. When I run the Arduino sketch and Max Patch using FTDI, everything works fine. However, when I plug in the radios, they fail to recognize each other as I get no green light on my Xbee explorer.

Also, I have ensured that the Baud rate in the code is consistent with the radios. I’m using 9600 although Andrew’s baud rate is set for 57600. I have tested using 57600 by re-configuring my radio but that was unsuccessful as well.

Do I need to adjust the Arduino code so that the arduino recognizes the radios?

Any guidance would be greatly appreciated. I have included Andrew’s code as well as his MaxPatch.

// Code for Getting all the Arduino inputs into MaxMSP
//Andrew Benson

char analogValue[12];//array of analog values
char current=0;//current position of analog value in array
int digVal;//digital pins bits are packed into a single variable
char imask = 128;//index bytes start with 1
char theEnd = 255;//byte to signal message end to Max patch

void setup(void) {
  for (int i = 2;i<14;i++){
    digitalWrite(i,HIGH);//enable pullups
  while (establishContact()==0){delay(100);}  //wait for 99 byte
//uses serial.write() to avoid needless symbol creation in MaxMSP  
void loop() {
  digVal=0; //reset digital value to 0
  //read digital pins
  for (int i = 0;i<11;i++){
     digVal |= (digitalRead(i+2)<>7);
  Serial.write(theEnd);//ends digital message

//read an analog pin and then pack into low/high bytes
void packValue(int index) {
      int tempA = analogRead(index);
      analogValue[current]=tempA & 127;
      analogValue[current] = (tempA>>7);

char establishContact(void){
    if (Serial.available() > 0) {
      char checkup =;
      if (checkup==99) return 1;
      else return 0;
    else return 0;

are you talking about line passing?