Spinning in Autonomous

After you figure out correct rotation direction for the turn like @Mentor_355U said, please, take a look at this topic:

You may need to add a setTimeout() call to ensure it never gets stuck with rotateFor().