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.
Dependencies: FRDM_MMA8451Q mbed
Revision 0:dc9bb280dcd5, committed 2013-11-13
- Comitter:
- schematic
- Date:
- Wed Nov 13 11:13:43 2013 +0000
- Commit message:
- AccelTest
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FRDM_MMA8451Q.lib Wed Nov 13 11:13:43 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/clemente/code/FRDM_MMA8451Q/#13e2af71e2cf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Nov 13 11:13:43 2013 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+#include "MMA8451Q.h"
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+
+// --- Set Accelerometer
+MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
+
+// --- Set Serial Port
+Serial pc(USBTX, USBRX); // tx, rxSerial pc(USBTX, USBRX); // tx, rx
+
+int main() {
+
+ //float aX;
+ //float aY;
+ float aZ;
+
+ //float z1;
+ //float z2;
+ //float diff;
+
+ // --- Baud rate setting
+ pc.baud(115200);
+ wait(1);
+
+ while(1) {
+
+ //aX = acc.getAccX();
+ //aY = acc.getAccY();
+ aZ = acc.getAccZ();
+
+ //sprintf(str, "%+6.*f", 4, val);
+ //printf("val = %s.\n", str);
+ //printf("%f\n", floatVal);
+
+
+ pc.printf("Z:%f<EOF>\r\n",aZ);
+
+
+ //wait(0.02);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Nov 13 11:13:43 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9c8f0e3462fb \ No newline at end of file