![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Isme orientation ke hisaaf se R G B ka light control karte h
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
diff -r 000000000000 -r 5fc7faf6f68c MMA8451Q.lib --- /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
diff -r 000000000000 -r 5fc7faf6f68c main.cpp --- /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); + } +}
diff -r 000000000000 -r 5fc7faf6f68c mbed.bld --- /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