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.
Revision 0:3ee8bb19ec63, committed 2017-01-18
- Comitter:
- mrunalmirani
- Date:
- Wed Jan 18 02:58:53 2017 +0000
- Commit message:
- fyhv
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Exp4.lib Wed Jan 18 02:58:53 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jan 18 02:58:53 2017 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+
+
+ PinName const SDA = PTE25;
+ PinName const SCL = PTE24;
+
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+Ticker acctick;
+DigitalOut fallled(LED2);
+void acctick_isr(void);
+void acctick_isr(void)
+{
+ float x, y, z,a;
+ x = acc.getAccX();
+ y = acc.getAccY();
+ z = acc.getAccZ();
+ a=sqrt(pow(x,2)+pow(y,2)+pow(z,2));
+ wait(0.1f);
+ printf("X: %1.2f, Y: %1.2f, Z: %1.2f, a: %1.2f \n", x, y, z,a);
+}
+int main(void)
+{
+ MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS);
+ fallled=1;
+ acctick.attach(&acctick_isr,0.01);
+ printf("MMA8451 ID: %d\n", acc.getWhoAmI());
+
+ while (true);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jan 18 02:58:53 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5 \ No newline at end of file