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:5fc7faf6f68c, committed 2016-07-02
- Comitter:
- akashlal
- Date:
- Sat Jul 02 07:19:44 2016 +0000
- Commit message:
- na
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Sat Jul 02 07:19:44 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Jul 02 07:19:44 2016 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+#include "MMA8451Q.h"
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+Serial pc(USBTX, USBRX);
+MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
+DigitalOut r(PTB18);
+DigitalOut g(PTB19);
+DigitalOut b(PTD1);
+
+int main() {
+ int xvali, yvali, zvali;
+ while(1) {
+ xvali = (acc.getAccX()+2)*100;
+ yvali = (acc.getAccY()+2)*100;
+ zvali = (acc.getAccZ()+2)*100;
+ pc.printf("$%d %d %d;",xvali,yvali,zvali);
+ if(xvali>230||xvali<170)
+ {
+ r=0;
+ g=1;
+ b=1;
+ }
+ if(yvali>230||yvali<170)
+ {
+ r=1;
+ g=0;
+ b=1;
+ }
+ if(zvali>230||zvali<170)
+ {
+ r=1;
+ g=1;
+ b=0;
+ }
+ // wait(0.2);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jul 02 07:19:44 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file