Arduino pro mini reads adxl x axis data when device is sleep

Hi

I am doing project to send adxl x axis data from one arduino to another. Transmitter side I am using arduino pro mini.

I want device to be sleep always and wakes up when adxl x axis is greater than some fixed value.

Is it possible to read adxl345 x axis data when arduino pro mini in sleep??

Hi

I am doing project to make led on and off if adxl x axis value is greater than 20.

here i want to make if x axis value is greater than 20 for more than 4 seconds only then led should turn on. else it should go be in off state.

can someone help me how this can be done.

#include <Wire.h>
#include <ADXL345.h>


ADXL345 adxl; //variable adxl is an instance of the ADXL345 library

int x;  


void setup(){
  Serial.begin(9600);
  adxl.powerOn();
}

void loop(){
  adxl.readAccel(&x); //read the accelerometer values and store them in variables  x,y,z
  Serial.print("x: "); 
  delay(1000);
  Serial.println(x);  
  if (x>20)
  {
  digitalWrite(ledPin, HIGH);
  }
  else
  {
  digitalWrite(ledPin, LOW);
  }// raw data without offset
}

Please supply more information.

ADXL data sheet? Which library do you use?

How do you configure the ADXL interrupts?

How do you sleep the Arduino? How wake?

How do the Arduinos communicate?

DrDiettrich:
Please supply more information.

ADXL data sheet? Which library do you use?

How do you configure the ADXL interrupts?

How do you sleep the Arduino? How wake?

How do the Arduinos communicate?

I amusing adxl345.

arduino wakesup if there is any interrupt change with the digital pin. this interrupt of digital pin made using adxl x axis value. if x axis is greater than 20 the digital pin 3 goes low else digital pin goes high.

the problem is after device is sending data one time if device goes to sleep the it is not wakes up to read adxl data. so i wnat to make adruni to read adxl data even in sleep mode. is this possible?

communication between two arduino is made using nrf24l01.

Please answer all questions. It makes a difference whether you want the device to generate an interrupt or you make it do so.

DrDiettrich:
Please answer all questions. It makes a difference whether you want the device to generate an interrupt or you make it do so.

arduino should read adxl data and makes digital pin as interrupt by making low or high.

so i wnat to make arduino to read adxl always

If the Arduino is asleep, it is inactive.

To read a value from a sensor you need to wake the Arduino up.

srnet:
If the Arduino is asleep, it is inactive.

To read a value from a sensor you need to wake the Arduino up.

Then how it can be made active?

To time events, use the millis() function and possibly, a state variable.

Here is a tutorial, showing how to use those techniques to detect long and short pushbutton presses.