Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions PiicoDev_LIS3DH.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@ def tapped(self):
self._read(_INT1_SRC,1) # clear interrupt pin
return True
return False

@property
def tapped_axis(self):
raw = self._read(_CLICKSRC,1)
axis_tapped =[False,False,False]
if raw & 0x40:
print(raw-64)
if raw & 0x04: # If respective bit is filled, flag the axes that was activated
axis_tapped[2] = True
if raw & 0x02:
axis_tapped[1] = True
if raw & 0x01:
axis_tapped[0] = True
self._read(_INT1_SRC,1)
return axis_tapped


def shake(self, threshold=15, avg_count=40, total_delay=100):
"""Detect when the accelerometer is shaken. Optional parameters:
Expand Down