tim008 tim008
/
LV09_Z01_Tim008_Grupa1
Kiselica Aldin Muslija Adnan
Revision 0:0e62084eedfb, committed 2014-05-12
- Comitter:
- tim008
- Date:
- Mon May 12 07:49:34 2014 +0000
- Commit message:
- LV9_PAI_Tim008_Z1
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Mon May 12 07:49:34 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/main.cpp Mon May 12 07:49:34 2014 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" +#include <string> +#include "MMA8451Q.h" + +#define MMA8451_I2C_ADDRESS (0x1d<<1) + +DigitalOut myled(LED1); +MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); +Serial pc(USBTX, USBRX); + + +Ticker ticker; + +void turnOnLed(char color, int ipct) +{ + if(color!='R' && color!='G' && color!='B') + return; + pc.printf("%d\n",ipct); +} + +void readAccValue() +{ + float x(acc.getAccX()),y(acc.getAccY()),z(acc.getAccZ()); + pc.printf("X value: %f; Y value: %f; Z value: %f;\n", x,y,z); +} + + +int main(){ + ticker.attach(readAccValue,1.5); + while(1); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon May 12 07:49:34 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776 \ No newline at end of file