![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Mini Project 10: Displaying stuff from day 7
Dependencies: DmTouch_UniGraphic UniGraphic mbed
Diff: main.cpp
- Revision:
- 14:682bdfcff46a
- Parent:
- 13:b3637adeaa2a
- Child:
- 15:565da8e90073
diff -r b3637adeaa2a -r 682bdfcff46a main.cpp --- a/main.cpp Tue Jan 17 23:34:00 2017 +0000 +++ b/main.cpp Tue Jan 17 23:48:14 2017 +0000 @@ -32,6 +32,7 @@ uint16_t tx, ty; Ticker inter_t; //Ticker for the touch screen Timer t; +float accel_x,accel_y,accel_mag; float compass_h; //compass heading float main_data[2]; @@ -128,8 +129,11 @@ myLCD.printf("A"); myLCD.fillcircle(60,100,30,Blue); getacceleration(main_data); + accel_x = main_data[0]; + accel_y = main_data[1]; + accel_mag = sqrt((accel_x*accel_x)+(accel_y*accel_y)); myLCD.locate(80,150); - myLCD.printf("%f accel",main_data[1]); + myLCD.printf("%f m/s^2",accel_mag); } if (choice == 2) //compass {