tim010 tim010
/
LV9_GRUPA7_TIM010_ZAD1
Kenan Mahmutović Anes Lučkin
main.cpp@0:619796332e11, 2014-05-15 (annotated)
- Committer:
- tim010
- Date:
- Thu May 15 16:53:36 2014 +0000
- Revision:
- 0:619796332e11
LV9_GRUPA7_TIM010_ZAD1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tim010 | 0:619796332e11 | 1 | #include "mbed.h" |
tim010 | 0:619796332e11 | 2 | #include "MMA8451Q.h" |
tim010 | 0:619796332e11 | 3 | #define MMA8451_I2C_ADDRESS (0x1d<<1) |
tim010 | 0:619796332e11 | 4 | |
tim010 | 0:619796332e11 | 5 | MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS); |
tim010 | 0:619796332e11 | 6 | |
tim010 | 0:619796332e11 | 7 | Serial pc(USBTX, USBRX); // tx, rx |
tim010 | 0:619796332e11 | 8 | |
tim010 | 0:619796332e11 | 9 | |
tim010 | 0:619796332e11 | 10 | int main() { |
tim010 | 0:619796332e11 | 11 | while(1) { |
tim010 | 0:619796332e11 | 12 | |
tim010 | 0:619796332e11 | 13 | float x_osa = acc.getAccX(); |
tim010 | 0:619796332e11 | 14 | float y_osa = acc.getAccY(); |
tim010 | 0:619796332e11 | 15 | float z_osa = acc.getAccZ(); |
tim010 | 0:619796332e11 | 16 | pc.printf("X osa:%f",x_osa); |
tim010 | 0:619796332e11 | 17 | pc.printf(" y osa:%f",y_osa); |
tim010 | 0:619796332e11 | 18 | pc.printf(" Z osa:%f\n",z_osa); |
tim010 | 0:619796332e11 | 19 | wait(0.8); |
tim010 | 0:619796332e11 | 20 | } |
tim010 | 0:619796332e11 | 21 | |
tim010 | 0:619796332e11 | 22 | } |