ADXL345 Interrupt

Hallo, i need help.
I found a code for ADXL345 interrupt for Single,double tap activity and free fall …but the sensitivity is so bad… It’s possible to increase that sensitivity please ?


//Arduino 1.0+ Only!
//Arduino 1.0+ Only!

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

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

void setup(){

//set activity/ inactivity thresholds (0-255)
adxl.setActivityThreshold(75); //62.5mg per increment
adxl.setInactivityThreshold(75); //62.5mg per increment
adxl.setTimeInactivity(10); // how many seconds of no activity is inactive?

//look of activity movement on this axes - 1 == on; 0 == off 

//look of inactivity movement on this axes - 1 == on; 0 == off

//look of tap movement on this axes - 1 == on; 0 == off

//set values for what is a tap, and what is a double tap (0-255)
adxl.setTapThreshold(50); //62.5mg per increment
adxl.setTapDuration(15); //625μs per increment
adxl.setDoubleTapLatency(80); //1.25ms per increment
adxl.setDoubleTapWindow(200); //1.25ms per increment

//set values for what is considered freefall (0-255)
adxl.setFreeFallThreshold(7); //(5 - 9) recommended - 62.5mg per increment
adxl.setFreeFallDuration(45); //(20 - 70) recommended - 5ms per increment

//setting all interupts to take place on int pin 1
//I had issues with int pin 2, was unable to reset it
adxl.setInterruptMapping( ADXL345_INT_SINGLE_TAP_BIT, ADXL345_INT1_PIN );
adxl.setInterruptMapping( ADXL345_INT_DOUBLE_TAP_BIT, ADXL345_INT1_PIN );
adxl.setInterruptMapping( ADXL345_INT_FREE_FALL_BIT, ADXL345_INT1_PIN );
adxl.setInterruptMapping( ADXL345_INT_ACTIVITY_BIT, ADXL345_INT1_PIN );
adxl.setInterruptMapping( ADXL345_INT_INACTIVITY_BIT, ADXL345_INT1_PIN );

//register interupt actions - 1 == on; 0 == off 
adxl.setInterrupt( ADXL345_INT_SINGLE_TAP_BIT, 1);
adxl.setInterrupt( ADXL345_INT_DOUBLE_TAP_BIT, 1);
adxl.setInterrupt( ADXL345_INT_FREE_FALL_BIT, 1);
adxl.setInterrupt( ADXL345_INT_ACTIVITY_BIT, 1);
adxl.setInterrupt( ADXL345_INT_INACTIVITY_BIT, 1);

void loop(){

//Boring accelerometer stuff 
int x,y,z; 
adxl.readAccel(&x, &y, &z); //read the accelerometer values and store them in variables x,y,z

// Output x,y,z values - Commented out

//Fun Stuff! 
//read interrupts source and look for triggerd actions

//getInterruptSource clears all triggered actions after returning value
//so do not call again until you need to recheck for triggered actions
byte interrupts = adxl.getInterruptSource();

// freefall
if(adxl.triggered(interrupts, ADXL345_FREE_FALL)){
//add code here to do when freefall is sensed

if(adxl.triggered(interrupts, ADXL345_INACTIVITY)){
//add code here to do when inactivity is sensed

if(adxl.triggered(interrupts, ADXL345_ACTIVITY)){
//add code here to do when activity is sensed

//double tap
if(adxl.triggered(interrupts, ADXL345_DOUBLE_TAP)){
Serial.println("double tap");
//add code here to do when a 2X tap is sensed

if(adxl.triggered(interrupts, ADXL345_SINGLE_TAP)){
//add code here to do when a tap is sensed


Can anyone help please ?

Can anyone help please ?

If you're not getting help it isn't because nobody wants to help.

You didn't give very much detail in your question. You have to understand that I'm not there with you. You have to give me everything I need in your post so that I can fully envision your project, how it works, and what it does. You just gave me a couple or poorly written sentences and some unformatted code that I refuse to try to read until you format it to make it readable.

The quality of the answers you get is directly proportional to the amount of effort you are willing to put into getting a good answer. Format your code so it's readable. The IDE will do it for you so you have absolutely no excuse for not doing it. Press control-T in the IDE. Add some details about the project. Think a little and help us to help you.

Ok so …
I’m working on motorcycle alarm.
I want to get arduino in sleep mode and when someone move with motorcycle, accelerometer will send interrupt, and i will be working with the measured X,Y,Z positions. Code i sended here is just for Tap or something like that and when i shake it, nothing happend. But the problem is, that i googled more than one day to get to know how to do it, but i found nothing.

So noone helps ?