Ok thanks for the clarification...
one last thing: in my project there is actually one movement which I won't need to do: which is the "pitch" on the image I've posted earlier.
I'm guessing that all I need to do is position the sensor perpendicular to ground
hence transforming the yaw (which I wouldn't need) into the pitch
and your code would still work...is that right?
would it work if I shift the frame of reference in such a way or the code measures pitch and roll in reference to the force of gravity?
thanks
b.