• Sounds like a really fun idea :)

    By 'yaw', you mean if you 'twist' the cube while it's on a flat surface?

    You'd need to use mpu.getRotation() to read the gyro I think? The accelerometer won't tell you that.

    I don't know exactly what the data coming out of it will be, so you'll have to experiment, but my guess is you'll want to look at the accelerometer value, and then use the 'other two' axes - so for instance if accelerometer Z is large (because of gravity) you'll want to use X and Y from the gyro.

    You could do it using 3D maths (cross products), but given you've got the code to work out direction already, it's probably best to do that.

About

Avatar for Gordon @Gordon started