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


The HMC6352 compass sensor.
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!
To create a device at the default address use:-
HMC6352 compass = MAKE_HMC6352();

or if you have changed the address to say 0x40 then use:
HMC6352 compass = MAKE_HMC6352_At(0x40);
Example for the Axon:-
#include "sys/Axon.h"
#include "rprintf.h"
#include "Sensors/Compass/Honeywell/HMC6352.h"

HMC6352 compass = MAKE_HMC6352();

void appInitHardware(void){
   //setup UART
   uartInit(UART1, 9600);
   // Initialise compass

TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
   return 0;

// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){
   rprintf("Compass = %d\n",compass.compass.bearingDegrees);
   return 0;




void HMC6352_1Hz(HMC6352* compass)

Sets the refresh rate to once per second.

void HMC6352_5Hz(HMC6352* compass)

Sets the refresh rate to five timers per second ie every 200ms.

void HMC6352_10Hz(HMC6352* compass)

Sets the refresh rate to ten times per second ie every 100ms.

void HMC6352_20Hz(HMC6352* compass)

Sets the refresh rate to twenty times per second ie every 50ms.

Valid XHTML 1.0 Transitional