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.
Diff: main.cpp
- Revision:
- 0:963078a66a9f
diff -r 000000000000 -r 963078a66a9f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon May 12 14:35:04 2014 +0000 @@ -0,0 +1,29 @@ + + + //PAI - L9 Z1 Kenan Dervisevic + #include "mbed.h" + #include "MMA8451Q.h" + #define MMA8451_I2C_ADDRESS (0x1d<<1) + //DigitalOut myled(LED1); + + Serial pc(USBTX, USBRX); + MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); //ispravljeno sa P_E25, P_E26 + + float x(0), y(0), z(0); + Ticker koordinate; + + void dajKoordinate() { + x = acc.getAccX(); + y = acc.getAccY(); + z = acc.getAccZ(); + } + + void komunikacija() { + dajKoordinate(); + pc.printf("X = %f, Y = %f, Z = %f\n", x, y, z); + } + + int main() { + koordinate.attach(&komunikacija, 1); + } +