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
Revision 4:5a98b723b199, committed 2014-09-12
- Comitter:
- dbaba
- Date:
- Fri Sep 12 08:15:40 2014 +0000
- Parent:
- 3:eea88312499a
- Commit message:
- initial.
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Fri Sep 12 08:15:40 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TSI.lib Fri Sep 12 08:15:40 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/TSI/#1a60ef257879
--- 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;
}