Use case

Dependencies:   mbed MMA8451Q

Files at this revision

API Documentation at this revision

Comitter:
daniwestside
Date:
Wed Oct 16 22:33:20 2019 +0000
Commit message:
MMA8451Q use case

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	Wed Oct 16 22:33:20 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/emilmont/code/MMA8451Q/#c4d879a39775
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 16 22:33:20 2019 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+
+Serial pc(USBTX, USBRX, 9600);
+
+int main(void) {
+   MMA8451Q acc(PA_10, PA_9, MMA8451_I2C_ADDRESS);
+   float x, y, z;
+   while (true) {
+      x = acc.getAccX();
+      y = acc.getAccY();
+      z = acc.getAccZ();
+      pc.printf("x = %f\t y = %f\t z = %f\n\r", x, y, z);
+
+      wait(5);
+   }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 16 22:33:20 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file