SCA3000 triple axis digital interface accelerometer example.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
aberk
Date:
Sun May 29 14:22:44 2011 +0000
Commit message:
Version 1.0

Changed in this revision

SCA3000.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SCA3000.lib	Sun May 29 14:22:44 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/aberk/code/SCA3000/#f5f2e79304fb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun May 29 14:22:44 2011 +0000
@@ -0,0 +1,27 @@
+#include "SCA3000.h"
+
+Serial pc(USBTX, USBRX);
+SCA3000 accelerometer(p5, p6, p7, p8, p9);
+
+int main() {
+
+    pc.printf("Starting SCA3000 test...\n");
+    
+    int revision = accelerometer.getRevId();
+    
+    pc.printf("Device revision number is: %i.%i\n", revision & 0xF0, revision & 0x0F);
+    
+    
+    while(1){
+    
+       //Arbitrary wait for printf clarity.
+       wait(0.1);
+       
+       //Print out the acceleration measured on each axis in milli-gs.
+       pc.printf("x:%f y:%f z:%f\n", accelerometer.getAcceleration(SCA3000_X_AXIS),
+                                     accelerometer.getAcceleration(SCA3000_Y_AXIS),
+                                     accelerometer.getAcceleration(SCA3000_Z_AXIS));
+
+    }
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun May 29 14:22:44 2011 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912