Datasheet
The tap detection works by looking for when one of the axes has an acceleration higher than a certain threshhold for
longer than a certain timelimit. The threshhold is in 'raw' values so you have to adjust it based on the scale/range
you've configured for the sensor:
Larger numbers are less sensitive, you'll really need to just tweak as necessary for your project.
You'll also have to turn on click detection. This will also se the INT pin to pulse high whenever a tap or double tap is
detected. If you turn on double tap detection it will still 'decode' single taps but the INT pin wont pulse on them.
setClick can actually take many more arguments, the full list is:
The timelimit timelatency and timewindow are in units of "ODR" so if you change the sample frequency of the LIS3DH
you'll have to adjust these as necessary. The App note has way more details on this, with pretty graphs & eveything!
// Adjust this number for the sensitivity of the 'click' force
// this strongly depend on the range! for 16G, try 5-10
// for 8G, try 10-20. for 4G try 20-40. for 2G try 40-80
#define CLICKTHRESHHOLD 80
// 0 = turn off click detection & interrupt
// 1 = single click only interrupt output
// 2 = double click only interrupt output, detect single click
// Adjust threshhold, higher numbers are less sensitive
lis.setClick(2, CLICKTHRESHHOLD);
void setClick(uint8_t c, uint8_t clickthresh, uint8_t timelimit = 10, uint8_t timelatency = 20, uint8_t
© Adafruit Industries https://learn.adafruit.com/adafruit-lis3dh-triple-axis-accelerometer-breakout Page 18 of 22










