WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

HMC6352 Compass

The HMC6352 compass sensor.
HMC6352.jpg
Manufacturers Datasheet: http://www.ssec.honeywell.com/magnetic/datasheets/HMC6352.pdf
Suppliers: http://www.sparkfun.com/commerce/product_info.php?products_id=7915
This compass is accessed over I2C at address 0x42 but this address can be changed by sending it the relevant command if you know what you are doing!
The compass only returns the bearing and so the roll and pitch values will always be zero.
The default refresh rate can be set up in Project Designer but may, if required, be changed at runtime using the various 'refresh' commands.
Example
Assuming you have called the device 'myCompass' in Project Designer then here is some example code:
// read the compass values and store the results
myCompass.read();
 
// Print out the bearing in degrees
cout << " Bearing:" << myCompass.getBearing();
// Or just dump everything in one go
cout << myCompass;
 
Function Summary

Valid XHTML 1.0 Transitional