This program displays x and y axis value on LCD
Dependencies: C12832 MMA7660 mbed
main.cpp@0:2cb49169252d, 2015-10-06 (annotated)
- Committer:
- dwijaybane
- Date:
- Tue Oct 06 10:17:20 2015 +0000
- Revision:
- 0:2cb49169252d
- Child:
- 1:d78fabd1905d
Display X and Y axis
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dwijaybane | 0:2cb49169252d | 1 | #include "mbed.h" |
dwijaybane | 0:2cb49169252d | 2 | #include "MMA7660.h" |
dwijaybane | 0:2cb49169252d | 3 | #include "C12832.h" |
dwijaybane | 0:2cb49169252d | 4 | |
dwijaybane | 0:2cb49169252d | 5 | C12832 lcd(p5, p7, p6, p8, p11); |
dwijaybane | 0:2cb49169252d | 6 | MMA7660 MMA(p28, p27); |
dwijaybane | 0:2cb49169252d | 7 | |
dwijaybane | 0:2cb49169252d | 8 | int main() { |
dwijaybane | 0:2cb49169252d | 9 | lcd.cls(); |
dwijaybane | 0:2cb49169252d | 10 | lcd.locate(0,3); |
dwijaybane | 0:2cb49169252d | 11 | lcd.printf("Accelerometer Value:"); |
dwijaybane | 0:2cb49169252d | 12 | |
dwijaybane | 0:2cb49169252d | 13 | while(1) { |
dwijaybane | 0:2cb49169252d | 14 | lcd.locate(0,15); |
dwijaybane | 0:2cb49169252d | 15 | lcd.printf("x=%5.4f y=%5.4f",MMA.x(),MMA.y()); |
dwijaybane | 0:2cb49169252d | 16 | wait(0.1); |
dwijaybane | 0:2cb49169252d | 17 | } |
dwijaybane | 0:2cb49169252d | 18 | } |