![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Working Menu, additions to be made
Dependencies: mbed
Diff: main.cpp
- Revision:
- 10:f894ac48a342
- Parent:
- 8:811fe7529732
- Child:
- 11:f1a6cced30cf
diff -r 811fe7529732 -r f894ac48a342 main.cpp --- a/main.cpp Fri Jan 28 16:43:14 2022 +0000 +++ b/main.cpp Fri Feb 04 14:45:43 2022 +0000 @@ -113,7 +113,6 @@ red_led3.write(0); // LED 3 will flash when you're beyond high temperature printf("Call Your GP \n"); // Printing to the LCD } - } } void init_serial() { @@ -148,41 +147,75 @@ void startup() // VOID FUNCTION SETUP { S_flag = 0; -int select = 0; +int select = 1; while (1) { char d = joystick.get_direction(); switch(select) { - case 0: - switch(d) { - case N: - select = 1; - // printf("UP"); - break; - case S: - select = 1; - // printf("Down"); - break; - } +case 1: +switch(d) { +case N: +select = 4; +wait(0.3); +// printf("UP"); +break; +case S: +select = 2; +wait(0.3); +// printf("Down"); +break; +} +break; + +case 2: +switch(d) { +case N: +select = 1; +wait(0.3); +// printf("UP"); +break; +case S: +select = 3; +wait(0.3); +// printf("Down"); +break; +} break; - case 1: - switch(d) { - case N: - select = 0; - // printf("UP"); - break; - case S: - select = 0; - // printf("Down"); - break; - } +case 3: +switch(d) { +case N: +select = 2; +wait(0.3); +// printf("UP"); +break; +case S: +select = 4; +wait(0.3); +// printf("Down"); break; } -// Menu +break; -if (select == 0){ +case 4: +switch(d) { +case N: +select = 3; +wait(0.3); +// printf("UP"); +break; +case S: +select = 1; +wait(0.3); +// printf("Down"); +break; +} +break; +} +wait(0.3); +// Menu +if (select == 1){ lcd.clear(); lcd.printString(" >Collection ", 0, 0); lcd.printString(" View Data ", 0, 1); @@ -192,26 +225,40 @@ wait(0.3);} -else if (select == 1) { -// Menu Selection -lcd.printString(" Collection ", 0, 0); +else if (select == 2) { +lcd.printString(" Collection ", 0, 0);// Menu Selection lcd.printString(" >View Data ", 0, 1); +lcd.refresh(); +wait(0.3);} +else if (select == 3) { +lcd.printString(" Collection ", 0, 0);// Menu Selection +lcd.printString(" View Data ", 0, 1); +lcd.printString(" >Live Data ", 0, 2); lcd.refresh(); -wait(0.3); -} +wait(0.3);} + +else if (select == 4){ +lcd.clear(); +lcd.printString(" Collection ", 0, 0);// Menu Selection +lcd.printString(" View Data ", 0, 1); +lcd.printString(" Live Data ", 0, 2); +lcd.printString(" >About ", 0, 3); +lcd.refresh(); +wait(0.3);} } } + void welcome() { - // Welcome Screen 1 +// Welcome Screen 1 lcd.clear(); lcd.printString(" Jack McGarley ", 0, 0); lcd.printString(" 18689007 ", 0, 1); lcd.printString(" Schneider ", 0, 2); lcd.printString(" Lincoln Uni ", 0, 3); -lcd.printString(" January 2022 ", 0, 4); +lcd.printString(" February 2022 ", 0, 4); lcd.refresh(); wait(3); // Welcome Screen 2