Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: motion.cpp
- Revision:
- 1:8f545f45d899
- Parent:
- 0:00669618559e
- Child:
- 2:4fb5a8d15f9c
--- a/motion.cpp Thu Nov 24 16:37:00 2016 +0000
+++ b/motion.cpp Fri Nov 25 03:44:54 2016 +0000
@@ -20,6 +20,16 @@
return motion_exceeded_threshold;
}
+float getAcceleration(){
+ float xAcc, yAcc, zAcc;
+ acc.getX(&xAcc);
+ acc.getY(&yAcc);
+ acc.getZ(&zAcc);
+ float magtd = xAcc*xAcc + yAcc*yAcc + zAcc*zAcc;
+ return magtd;
+}
+
+
void resetMotionDetection () {
motion_exceeded_threshold = 0;
}