Receiving data to pure data/Max MSP


I'm currently using a MMA8452Q, which is giving me 3 streams of data for the x,y and Z. I am now trying to get these 3 streams of data to show in either MSP or PD (preferably MSP).

However, the only information I am managing to get into max seems to be a selection of either numbers around 40, 50 and the occasional 9. ( this was when I was trying with pure data)

Whereas the stream of data coming into the serial monitor gives me 3 numbers anywhere between -1 and 1, e.g -0.789.

So I'm trying to work out how to get the same numbers that show in the serial monitor to appear in Max or PD

I have been following this tutorial for max:

and used the this patch for PD:

Here is the arduino code:

#include <Wire.h>                 // Must include Wire library for I2C
#include "SparkFun_MMA8452Q.h"    // Click here to get the library: http://librarymanager/All#SparkFun_MMA8452Q

MMA8452Q accel;                   // create instance of the MMA8452 class

void setup() {
  Serial.println("MMA8452Q Basic Reading Code!");

  if (accel.begin() == false) {
    Serial.println("Not Connected. Please check connections and read the hookup guide.");
    while (1);

void loop() {
  if (accel.available()) {      // Wait for new data from accelerometer
    // Acceleration of x, y, and z directions in g units
    Serial.print(accel.getCalculatedX(), 3);
    Serial.print(accel.getCalculatedY(), 3);
    Serial.print(accel.getCalculatedZ(), 3);

any help would be great, thanks

That MaxMSP tutorial is expecting integers from the Arduino. Your acceleration values are floating point numbers. You will need to use atof().

That tutorial reads one line of data and converts it into 1 number. You send 3 numbers. Your MSP program will need to use atof() 3 times.