![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Working Menu, additions to be made
Dependencies: mbed
Diff: main.cpp
- Revision:
- 5:bec67fb2b2f9
- Parent:
- 4:143487eef742
- Child:
- 6:e6e7b99198fd
--- a/main.cpp Fri Jan 28 09:37:53 2022 +0000 +++ b/main.cpp Fri Jan 28 13:22:05 2022 +0000 @@ -41,9 +41,10 @@ InterruptIn sw3(SW3); DigitalOut r_led(LED_RED); // K64F on-board LEDs -DigitalOut g_led(LED_GRN); +DigitalOut g_led(LED_GREEN); DigitalOut b_led(LED_BLUE); +// DECLARE VOIDS BEING USED IN CODE void error(); // error function hangs flashing an LED @@ -52,45 +53,49 @@ void init_K64F(); // Setting up the on-board LEDs and switches void init_leds(); //Setting up the LEDs + +void startup(); + int main() { - init_K64F(); // Initialising the board, serial port, LED'S and joystick - init_serial(); - init_leds(); - joystick.init(); +init_K64F(); // Initialising the board, serial port, LED'S and joystick +init_serial(); +init_leds(); +joystick.init(); - tmp102.init(); // call the sensor init method using dot syntax +tmp102.init(); // call the sensor init method using dot syntax - lcd.init(); // initialise display +lcd.init(); // initialise display - lcd.setContrast(0.5); // Sets contrast to 0.5 +lcd.setContrast(0.5); // Sets contrast to 0.5 - while (1) { +while (1) { - // these are settings that I have adjusted - lcd.normalMode(); // normal colour mode - lcd.setBrightness(0.75); // put LED backlight on 75% +// these are settings that I have adjusted +lcd.normalMode(); // normal colour mode +lcd.setBrightness(0.75); // put LED backlight on 75% +startup(); // USE VOID NOW - float T = tmp102.get_temperature(); // read temperature and print over serial port - pc.printf("T = %.1f K\n",T); +float T = tmp102.get_temperature(); // read temperature and print over serial port +pc.printf("T = %.1f K\n",T); - if (T > 37.2) { - red_led1.write(0); // LED 1 will flash when you're in High Temp - pc.printf("High Temperature \n"); // Printing to the LCD - } +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 +} - else if (T < 36.1) { - red_led2.write(0); // LED 2 will flash when you're in Low Temp - printf("Low Temperature \n"); // Printing to the LCD - } - else if (T > 38) { - red_led3.write(0); // LED 3 will flash when you're beyond high temperature - printf("Call Your GP \n"); // Printing to the LCD - } +else if (T < 36.1f) { +red_led2.write(0); // LED 2 will flash when you're in Low Temp +printf("Low Temperature \n"); // Printing to the LCD +} +else if (T > 38) { +red_led3.write(0); // LED 3 will flash when you're beyond high temperature +printf("Call Your GP \n"); // Printing to the LCD +} } } @@ -118,4 +123,21 @@ grn_led1.write(1); grn_led2.write(1); grn_led3.write(0); // LED on to show the board is on +} +void lcd_sett() +{ + //LCD SET + } +void startup() // VOID FUNCTION SETUP +{ +// Welcome Screen +lcd.clear(); +lcd.printString(" Jack McGarley ", 0, 0); +lcd.printString(" 1868007 ", 0, 2); +lcd.printString(" Schneider ", 0, 3); +lcd.printString(" Lincoln Uni", 0, 4); +lcd.printString(" January 2022", 0, 5); +lcd.refresh(); + +char d = joystick.get_direction(); } \ No newline at end of file