SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By tnts
#195324
Hello,

I am trying to get my arduino to sleep and wake up on event from adxl345. So far so good->that part was easy.
But....
I can do that only once or twice and then my device hungs completely.
Unless i od that constantly:
Code: Select all
interrupts = adxl.getInterruptSource();
    do {

      //Activity
      if (adxl.triggered(interrupts, ADXL345_ACTIVITY)) {
        Serial.println("*** ACTIVITY ***");
        bb(); //blink
        adxl.get_Gxyz(xyz);
      }
      interrupts = adxl.getInterruptSource();
      Serial.println ("Interrupts="+(String)interrupts);
    } while (interrupts != 0); //never true
It looks like internal buffer is filling ... so I put FIFO to bypass mode during setup().
Code: Select all
	setRegisterBit(ADXL345_FIFO_CTL, 7, 0); 
	setRegisterBit(ADXL345_FIFO_CTL, 6, 0); 
but it did not help....


Have you seen a proper way to handle adxl345 with interrupts and sleep?