Mini Project 10: Displaying stuff from day 7
Dependencies: DmTouch_UniGraphic UniGraphic mbed
Revision 16:995c9920f14e, committed 2017-01-18
- Comitter:
- swescott17
- Date:
- Wed Jan 18 01:48:47 2017 +0000
- Parent:
- 15:565da8e90073
- Commit message:
- Reading every ten seconds
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 565da8e90073 -r 995c9920f14e main.cpp --- a/main.cpp Wed Jan 18 01:08:33 2017 +0000 +++ b/main.cpp Wed Jan 18 01:48:47 2017 +0000 @@ -55,6 +55,38 @@ { myLCD.cls(); //reset UI(); + if (choice == 1) //acceleration + { + myLCD.locate(60, 100); + 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 m/s^2",accel_mag); + + } + if (choice == 2) //compass + { + myLCD.locate(160, 100); + myLCD.printf("C"); + myLCD.fillcircle(160,100,30,Green); + compass_h = compass_n(); + myLCD.locate(80, 150); + myLCD.printf("%f degrees N", compass_h); + //compass + } + if (choice == 3) //temperature + { + myLCD.locate(260, 100); + myLCD.printf("T"); + myLCD.fillcircle(260,100,30,Red); + temp2 = temperature(); + myLCD.locate(80, 150); + myLCD.printf("%f C", temp2); + } } int main() { @@ -124,43 +156,12 @@ } else if (lastDown) { - if (choice == 1) //acceleration - { - myLCD.locate(60, 100); - 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 m/s^2",accel_mag); - - } - if (choice == 2) //compass - { - myLCD.locate(160, 100); - myLCD.printf("C"); - myLCD.fillcircle(160,100,30,Green); - compass_h = compass_n(); - myLCD.locate(80, 150); - myLCD.printf("%f degrees N", compass_h); - //compass - } - if (choice == 3) //temperature - { - myLCD.locate(260, 100); - myLCD.printf("T"); - myLCD.fillcircle(260,100,30,Red); - temp2 = temperature(); - myLCD.locate(80, 150); - myLCD.printf("%f C", temp2); - } + button(); } wait(0.040); lastDown = down; } - inter_t.attach(&button,10); + inter_t.attach(&button,10); } }