Is it possible to turn the robot to a certain degree with Compass?

I think one problem is that when you test for "while (! counter == angle)" if you overshoot even one degree you will have to take a full rotation to try again. You should probably turn in the shortest direction:

void turnTheRobot(int newBearing){
  while (1) {  // Repeat unit break
    int currentBearing = getBearing();
    int error = currentBearing - newBearing;
    if (error == 0) 
        break;  // All done!
    if (error > 180)
        error -= 360;  // Shorter to turn left
    if (error < -180)
        error += 360;  // Shorter to turn right

  if (error < 0)  // Turn left
    {
    turnLeft(leftmotorSpeed, rightmotorSpeed);
    }
  else  // turn right
    {
    turnRight(leftmotorSpeed, rightmotorSpeed);
    }
  }
}