Basically, I need use micro:bit accelerometer to move straight forward avoiding curved movements. So far I have calculated roll and pitch using the code below
X = Sensors.acceleration(Sensors.X) / divider;
Z = Sensors.acceleration(Sensors.Y) / divider;
Y = Sensors.acceleration(Sensors.Z) / divider;
roll = atan(Y/sqrt(pow(X, 2)+pow(Z, 2))) * 180 / 3.14;
pitch = atan(-1*X/sqrt(pow(Y,2)+pow(Z,2))) * 180 / 3.14;
I have changed Z and Y on purpose, since if the microbit is on maqueen, the "new" Z axes is the initial Y.
The thing is that I need to calculate the Z rotation (yaw) in order to check if the maqueen moves in curved line. Any ideas?