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