// a demonstration of the following is at // http://www.varesano.net/blog/fabio/ahrs-sensor-fusion-orientation-filter-3d-graphical-rotating-cube rotateZ(-kalman[2]); rotateX(-kalman[1]); rotateY(-kalman[0]);

Even if your readQ() method actually read anything, what it reads is strings. Your decodeFloat() function expects that the String passed in consists of 3 bytes of binary data. It does not, so that code is crap, too. Processing knows how to split a tab delimited String into an array of floats. Why don't you just let it? Your Processing code is far more complex (and wrong) than it needs to be.

// The font must be located in the sketch's "data" directory to load successfully font = loadFont("CourierNew36.vlw"); // Loading the textures to the cube // The png files alow to put the board holes so can increase realism

// a demonstration of the following is at // http://www.varesano.net/blog/fabio/ahrs-sensor-fusion-orientation-filter-3d-graphical-rotating-cube rotateZ(-stringKalmanX); rotateX(-stringKalmanY); rotateY(-stringKalmanZ);