The NXT Compass Sensor is a digital compass that measures the earth’s magnetic field and outputs a value representing the current heading. The magnetic heading is calculated to the nearest 1° and returned as a number from 0 to 359. The NXT Magnetic Compass Sensor updates the heading 100 times per second. The Compass Sensor operates in two modes, Read mode and Calibrate mode. In Read mode, the current heading is calculated and returned each time to the NXT program executes a read command. In Calibrate mode the compass can be calibrated to compensate for externally generated magnetic field anomalies such as those that surround motors and batteries, thereby maintaining maximum accuracy.