![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Emrah Dautbegović Edis Kunić
main.cpp@0:6df852bbe791, 2014-05-15 (annotated)
- Committer:
- tim008
- Date:
- Thu May 15 16:39:27 2014 +0000
- Revision:
- 0:6df852bbe791
LV9-PAI-GRUPA7-TIM8-ZAD1;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tim008 | 0:6df852bbe791 | 1 | |
tim008 | 0:6df852bbe791 | 2 | #include "mbed.h" |
tim008 | 0:6df852bbe791 | 3 | #include "MMA8451Q.h" |
tim008 | 0:6df852bbe791 | 4 | #define MMA8451_I2C_ADDRESS (0x1d << 1) |
tim008 | 0:6df852bbe791 | 5 | |
tim008 | 0:6df852bbe791 | 6 | Serial pc(USBTX, USBRX); |
tim008 | 0:6df852bbe791 | 7 | MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); |
tim008 | 0:6df852bbe791 | 8 | Ticker t; |
tim008 | 0:6df852bbe791 | 9 | |
tim008 | 0:6df852bbe791 | 10 | void procitaj() { |
tim008 | 0:6df852bbe791 | 11 | pc.printf("X-osa: %.3f Y-osa: %.3f Z-osa: %.3f \n\r", acc.getAccX(), acc.getAccY(), acc.getAccZ()); |
tim008 | 0:6df852bbe791 | 12 | } |
tim008 | 0:6df852bbe791 | 13 | |
tim008 | 0:6df852bbe791 | 14 | int main() { |
tim008 | 0:6df852bbe791 | 15 | t.attach(procitaj, 1.5); |
tim008 | 0:6df852bbe791 | 16 | while (1); |
tim008 | 0:6df852bbe791 | 17 | } |