How calculate yaw?
Assuming you aren't moving much first find the up direction by using the accelerometers to measure gravity. Then use the gyroscopes to measure rates of turn on each axis. Scale these by the correct amount based on the orientation and that will give you a yaw rate. Integrate the yaw rate over time to give you yaw.
Why do we use Euler angles?
However, Euler angles do have one advantage over Quaternions: Euler angles can tell you the direction and magnitude of a rotation. When you convert a Euler angle to a Quaternion, that information is lost.