Log acceleration triggered by threshold

I'm quite new here. On my Android API, at the moment I'd like to measure acceleration x,y,z and only log it if it is higher than a value, so I optimise my memory by not saving insignificant positive/negative accelerations for my application. Is there any example code for me to use as a model.

Use case:

Measure at 400Hz for x,y,z but only log acceleration if:

  • acc in y is higher than 2g or lower than -2g.
  • acc in x is higher than 0.5g or lower than -0.5g.
  • acc in z is higher than 0.5g or lower than -0.5g.

Thank you in advance,
Alejandro Cid


  • Yes, you can do that with the macro, threshold, and logging modules.

Sign In or Register to comment.