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

HMC6343 Compass

The HMC6343 compass sensor.
HMC6343.jpg
Manufacturers Datasheet: http://www.ssec.honeywell.com/magnetic/datasheets/HMC6343.pdf
Suppliers: http://www.sparkfun.com/commerce/product_info.php?products_id=8656
This compass is accessed over I2C at address 0x32 but this address can be changed by sending it the relevant command if you know what you are doing!
The compass returns bearing, roll and pitch.
The refresh rate of the device can be defined in Project Designer and, if necessary, can be changed at runtime with the various 'refresh' functions.
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 values in degrees
cout << " Bearing:" << myCompass.getBearing();
cout << " Roll:" << myCompass.getRoll();
cout << " Pitch:"   << myCompass.getPitch();
 
// Or just dump everything in one go
cout << myCompass;
 
Function Summary

Valid XHTML 1.0 Transitional