tim008 tim008
/
LV9_Grupa5_Tim8_Zadatak1
Amer Ratković Emina Muharemović
main.cpp@0:d7ec456391a0, 2014-05-15 (annotated)
- Committer:
- tim008
- Date:
- Thu May 15 12:32:41 2014 +0000
- Revision:
- 0:d7ec456391a0
LV9_Grupa5_Tim8_Zadatak1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tim008 | 0:d7ec456391a0 | 1 | #include "mbed.h" |
tim008 | 0:d7ec456391a0 | 2 | #include "MMA8451Q.h" |
tim008 | 0:d7ec456391a0 | 3 | #define MMA8451_I2C_ADDRESS (0x1d << 1) |
tim008 | 0:d7ec456391a0 | 4 | |
tim008 | 0:d7ec456391a0 | 5 | Serial pc(USBTX, USBRX); |
tim008 | 0:d7ec456391a0 | 6 | MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); |
tim008 | 0:d7ec456391a0 | 7 | Ticker t; |
tim008 | 0:d7ec456391a0 | 8 | |
tim008 | 0:d7ec456391a0 | 9 | void procitaj() { |
tim008 | 0:d7ec456391a0 | 10 | pc.printf("\nX-osa: %.3f\nY-osa: %.3f\nZ-osa: %.3f\n", acc.getAccX(), acc.getAccY(), acc.getAccZ()); |
tim008 | 0:d7ec456391a0 | 11 | } |
tim008 | 0:d7ec456391a0 | 12 | |
tim008 | 0:d7ec456391a0 | 13 | int main() { |
tim008 | 0:d7ec456391a0 | 14 | t.attach(procitaj, 1.5); |
tim008 | 0:d7ec456391a0 | 15 | while (1); |
tim008 | 0:d7ec456391a0 | 16 | } |