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: MMA8451Q TSI mbed
Diff: main.cpp
- Revision:
- 4:5a98b723b199
- Parent:
- 1:32eacc4f6beb
diff -r eea88312499a -r 5a98b723b199 main.cpp
--- a/main.cpp Tue Feb 19 23:48:41 2013 +0000
+++ b/main.cpp Fri Sep 12 08:15:40 2014 +0000
@@ -1,15 +1,22 @@
#include "mbed.h"
+#include "MMA8451Q.h"
+#include "TSISensor.h"
+
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
DigitalOut myled(LED_GREEN);
-Serial pc(USBTX,USBRX);
+Serial serial(USBTX,USBRX);
+MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
+TSISensor tsi;
int main() {
+
int i=0;
- pc.printf("\nHello World!\n");
while (true) {
- wait(0.5);
- pc.printf("%d\n",i);
+ //wait(0.5);
+ serial.printf("{\"i\":%d,\"x\":%5.2f,\"y\":%5.2f,\"z\":%5.2f, \"tsi\":%5.2f}\n",
+ i, acc.getAccX(), acc.getAccY(), acc.getAccZ(), tsi.readPercentage());
i++;
myled = !myled;
}