LSM303D Interrupts

I am having trouble getting the click interrupts to work for the LSM303D. using the library provided by Pololu for arduino I can get this code working for the DLHC

#include <Wire.h>
#include <LSM303.h>
long thisLong = 0;
LSM303 compass;
const byte interruptPin = 2;

void setup()
{
  Serial.begin(9600);
  Wire.begin();
  compass.init();
  compass.enableDefault();  
  compass.writeAccReg(LSM303::CTRL3,     0b11000000);
  compass.writeAccReg(LSM303::CTRL0,     0b00000000);
  compass.writeAccReg(LSM303::CLICK_CFG, 0b00010000);
  compass.writeAccReg(LSM303::CLICK_THS, 0b00011111);
  compass.writeAccReg(LSM303::TIME_LIMIT, 0b00011111);

  delay(100);
  attachInterrupt(digitalPinToInterrupt(interruptPin), reset, CHANGE);
}

void loop()
{
  Serial.print(thisLong);
  Serial.println("");
  thisLong++;
  delay(100);
}

void reset() {
  thisLong = 0;
}

But when I try it on the LSM303D it doesn’t seem to generate the interrupt. I can read the CLICK_SRC register and the interrupt shows active, but the INT1 pin never goes from low to high. Anyone work with these at all?

Hello.

I tried running your code and it seemed to work fine. Did you change anything else about your setup other than swapping out the LSM303 sensors? (One thing to maybe watch out for is that the INT1 pins are in different places on our LSM303DLHC and LSM303D carriers.) What type of Arduino are you using?

Kevin