Josip Kvesić

Dependencies:   MMA8451Q mbed

Files at this revision

API Documentation at this revision

Comitter:
tim010
Date:
Thu May 15 15:14:21 2014 +0000
Commit message:
LV9-grupa6-tim010

Changed in this revision

MMA8451Q.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/MMA8451Q.lib	Thu May 15 15:14:21 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/JoKer/code/MMA8451Q/#2d14600116fc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 15 15:14:21 2014 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+ 
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+  
+    Serial pc(USBTX, USBRX);
+    MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); 
+    float x(0), y(0), z(0);
+    Ticker koordinate;
+     
+    void dajKoordinate() {
+        x = acc.getAccX();
+        y = acc.getAccY();
+        z = acc.getAccZ();
+    }
+     
+    void prikazi() {
+           dajKoordinate();
+           pc.printf("X = %f, Y = %f, Z = %f\n", x, y, z);
+    }
+     
+    int main() {
+        koordinate.attach(&prikazi, 1);
+    }
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 15 15:14:21 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file