#include //necessary only for I2C devices #include #include /*************************************************** /MINDS-i Calibration. mymindsi.com / /Compass Calibration / /This Compass Calibration code is used to test /and adjust your compass as well as to establish /the measurement that it’s reading. /in addition to the regular includes, the compass sensor requires Wire.h / /To learn more about the compass visit: /http://www.parallax.com/Store/Sensors/CompassGPS/tabid/173/CategoryID/48/List/0/SortField/0/Level/a/ProductID/779/Default.aspx /***************************************************/ float val; void setup() { Serial.begin(9600); //start a serial connection beginCompass(); //turn on the compass sensor } void loop() { val = getHeading(); //read the current heading from the sensor Serial.println(val,DEC); //send a string or value on the serial connection }