Arduino 101 + Adafruit HMC5883L Magnetometer

Hi, I want to use the Adafruit HMC5883L Magnetometer on the Arduino 101 board. But at the moment, it doesn't pump out any values (header/ headerDegrees), it does actually display the pre-startup jargon though...

i.e

void displaySensorDetails()
{
  sensor_t sensor;
  mag.getSensor(&sensor);
  Serial.println("------------------------------------");
  Serial.print  ("Sensor:       "); Serial.println(sensor.name);
  Serial.print  ("Driver Ver:   "); Serial.println(sensor.version);
  Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id);
  Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println(" uT");
  Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println(" uT");
  Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" uT");  
  Serial.println("------------------------------------");
  Serial.println("");
  delay(500);
}

I have an Uno too, and the HMC5883L works fine with this, but doesn't for the 101. I have the I2C pins conencted to SCL and SDA on the 101 (not to pins A4 and A5, but have tried this too). Is the Magnetometer too outdated for the 101, does the 101 lack support?

Though I am using a PID controller and the HMC5883L as the input for this, (and using Servo's as the output) and I am having problems with this responding with the output, which is just displaying the lowest possible value (i.e if definte output limits (0, 100), it will just stay at 0) for the output (this is with the Uno). I have written a PID for the 101's onboard IMU, which works fine for the PID controller, except the IMU drifts in the YAW axis, which is why I wanted to connect the Magnetometer as a second point of reference.

If anyone could provide me with a bit of advice, I would be most grateful!
Though a little bit hesitant to upload my full code, not because I don't want to, it's because my project is actually a masters project, so I'm not sure the "rules" about uploading my work which will be formally assessed (but asking for help/ suggestions is fine). Though my code is based upon the prewritten magsensor example, with the PID controller integrated. I have taken the local variables out of the code and made them global.

EDIT:

Never Mind,

got it to work!

It appears to be these lines that are stopping the code from running:

sensors_event_t event;
mag.getEvent(&event);

Would you mind sharing how you got it to work? I'm stalled at the same point as you -- and from the code I'm looking at getSensorDetails doesn't actually ever grab anything from the compass.

Aah, sorry, got the Uno to display an Output for the PID, I never managed to get the 101 to communicate with the Magnetometer. I may try to create communication between the two Arduino's though, and incorporate both forms of IMU information.

Apologies if this sounds ignorant as I still consider myself a noob, but the Arduino 101 doesn't seem as user friendly as the Uno. I know it's a reasonably new device, but still, the example codes that work perfectly on the Uno just seem to break on the 101! Is it to do with it being a Curie Chip... There's not even an M_PI function (from avr libc)? It seems to be written for the ATmega chips. I though the point of libraries is that they should be standard and readily used.

(Sorry, mini ignorant rant over)

Indeed -- I've managed to get a few samples running but it seems all of them require minor tweaks rather than download-and-run as you'd expect from demo code.

And then there's the whole issue of the board not even recognizing that an I2C sensor is attached...