Prateek Agrawal
/
lab14_accelerometer
22
main.cpp@0:6681d5f7ebda, 2017-04-02 (annotated)
- Committer:
- prtkmynk
- Date:
- Sun Apr 02 11:56:23 2017 +0000
- Revision:
- 0:6681d5f7ebda
22; ;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
prtkmynk | 0:6681d5f7ebda | 1 | #include "mbed.h" |
prtkmynk | 0:6681d5f7ebda | 2 | #include "MMA8451Q.h" |
prtkmynk | 0:6681d5f7ebda | 3 | |
prtkmynk | 0:6681d5f7ebda | 4 | MMA8451Q acc(PTE25,PTE24,0X1d<<1); |
prtkmynk | 0:6681d5f7ebda | 5 | Serial pc(USBTX,USBRX); |
prtkmynk | 0:6681d5f7ebda | 6 | |
prtkmynk | 0:6681d5f7ebda | 7 | float xaxis; |
prtkmynk | 0:6681d5f7ebda | 8 | char choice; |
prtkmynk | 0:6681d5f7ebda | 9 | |
prtkmynk | 0:6681d5f7ebda | 10 | main() |
prtkmynk | 0:6681d5f7ebda | 11 | { |
prtkmynk | 0:6681d5f7ebda | 12 | while(1) |
prtkmynk | 0:6681d5f7ebda | 13 | { |
prtkmynk | 0:6681d5f7ebda | 14 | |
prtkmynk | 0:6681d5f7ebda | 15 | xaxis = acc.getAccX(); |
prtkmynk | 0:6681d5f7ebda | 16 | pc.printf("%0.2f",xaxis); |
prtkmynk | 0:6681d5f7ebda | 17 | wait(3); |
prtkmynk | 0:6681d5f7ebda | 18 | } |
prtkmynk | 0:6681d5f7ebda | 19 | } |
prtkmynk | 0:6681d5f7ebda | 20 | |
prtkmynk | 0:6681d5f7ebda | 21 |