I am getting a high on int all the time even when there are no changes. I am using the advanced example. Has anyone else this problem? Is this normal? Can i change a register to get it to only trip int1 when there is motion?
I never used this chip but am look through the data sheet on INT1 usage. Here are the relevant sections to read:
5.9
Table 11, CNT_REG5
Table 61 & 62
Other than these the DS a rather vague on how the INT1 & 2 pins work.
Dig and read carefully. There may be something needed to be written to to clear an existing INT (clear interrupt Flag in processors idea).
My guess from looking at the source code and Table 14 in the datasheet is that the interrupt is signalling that new data is available.
From the DS, Table 14: Bit 0 (SRC_DRDY)
Data Ready Interrupt bit status. Default value: 0.
Logic ‘1’ indicates that the X, Y, Z data ready interrupt is active indicating the presence of new data and/or data overrun. Otherwise if it is a logic ‘0’ the X, Y, Z interrupt is not active.
This bit is asserted when the ZYXOW and/or ZYXDR is set and the interrupt has been enabled.
This bit is cleared by reading the X, Y, and Z data.
From the sketch :
void loop()
{
static byte source;
/* If int1 goes high, all data registers have new data */
if (digitalRead(int1Pin)) // Interrupt pin, should probably attach to interrupt function
//if (readRegister(0x00)&0x7) // Polling, you can use this instead of the interrupt pins
{
readRegisters(0x01, 6, &data[0]); // Read the six data registers into data array