![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Working Menu, additions to be made
Dependencies: mbed
Diff: main.cpp
- Revision:
- 9:80d9b5da15aa
- Parent:
- 8:811fe7529732
diff -r 811fe7529732 -r 80d9b5da15aa main.cpp --- a/main.cpp Fri Jan 28 16:43:14 2022 +0000 +++ b/main.cpp Fri Feb 04 13:49:12 2022 +0000 @@ -70,6 +70,7 @@ void startup(); +void tmp_logging(); int main() { @@ -89,7 +90,9 @@ lcd.setContrast(0.5); // Sets contrast to 0.5 welcome(); -startup(); // USE VOID NOW +startup(); // Use Void Now + +int log[4] = {0,0,0,0}; while (1) { @@ -103,6 +106,7 @@ if (T > 37.2f) { red_led1.write(0); // LED 1 will flash when you're in High Temp pc.printf("High Temperature \n"); // Printing to the LCD +tmp_logging(); } else if (T < 36.1f) { @@ -141,11 +145,10 @@ grn_led2.write(1); grn_led3.write(0); // LED on to show the board is on } -void lcd_sett() +void lcd_sett()//LCD Set { -//LCD SET } -void startup() // VOID FUNCTION SETUP +void startup() // Void Function Setup { S_flag = 0; int select = 0; @@ -154,35 +157,34 @@ 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 0: +switch(d) { +case N: +select = 1; +// printf("UP"); +break; +case S: +select = 1; +// printf("Down"); +break; +} break; - case 1: - switch(d) { - case N: - select = 0; - // printf("UP"); - break; - case S: - select = 0; - // printf("Down"); - break; - } +case 1: +switch(d) { +case N: +select = 0; +// printf("UP"); +break; +case S: +select = 0; +// printf("Down"); break; } -// Menu +break; +} -if (select == 0){ +if (select == 0){ // Menu lcd.clear(); lcd.printString(" >Collection ", 0, 0); lcd.printString(" View Data ", 0, 1); @@ -192,8 +194,7 @@ wait(0.3);} -else if (select == 1) { -// Menu Selection +else if (select == 1) { // Menu Selection lcd.printString(" Collection ", 0, 0); lcd.printString(" >View Data ", 0, 1); @@ -204,19 +205,18 @@ } void welcome() -{ - // Welcome Screen 1 +{ lcd.clear(); -lcd.printString(" Jack McGarley ", 0, 0); +lcd.printString(" Jack McGarley ", 0, 0); // Welcome Screen 1 lcd.printString(" 18689007 ", 0, 1); lcd.printString(" Schneider ", 0, 2); lcd.printString(" Lincoln Uni ", 0, 3); lcd.printString(" January 2022 ", 0, 4); lcd.refresh(); wait(3); -// Welcome Screen 2 + lcd.clear(); -lcd.printString(" Temperature ", 0, 0); +lcd.printString(" Temperature ", 0, 0); // Welcome Screen 2 lcd.printString(" Based ", 0, 1); lcd.printString(" Smart Device ", 0, 2); lcd.printString(" Health ", 0, 3); @@ -232,4 +232,11 @@ void button_back_isr() { B_flag = 1; +} +void tmp_logging() +{ + while(1){ + float T = tmp102.get_temperature(); + log[0] = T; + } } \ No newline at end of file