Rotate a cube exactly 90 degrees with angular velocity

I’m building a game that requires a cube to rotate 90 degrees when a button is pressed, it will rotate left, right, up, or down depending on which button is pressed. I’ve gotten the cube to rotate in the proper direction at the proper time using angular velocity, but I can’t stop the cube at the right time (the right time being when it has gone 90 degrees). I’m using logic bricks, but only because I’m unfamiliar with python, I’ve programmed before in other languages and am open to any python solutions you have. Also I’ve tried to use orientation constraints to limit the rotation, but they don’t seem to do anything, if I’m on the right track but missing something, please let me know. Thanks!