ELEC2645 (2018/19) / Mbed 2 deprecated el17dtt

Dependencies:   mbed

Revision:
4:2deeeeb6c1e1
Parent:
3:f686f6d7bdff
Child:
5:5e92567d0a44
--- a/main.cpp	Wed Apr 10 08:00:16 2019 +0000
+++ b/main.cpp	Wed Apr 10 21:35:21 2019 +0000
@@ -24,28 +24,32 @@
 Gamepad gamepad;
 
 ///////////// prototypes ///////////////
-
+void init();
+void welcome();
 
 ///////////// functions ////////////////
 int main() {
-    // initialize the gamepad
-    gamepad.init();
-    gamepad.leds_on();
     
-    // initialize the lcd
-    lcd.init();
-    lcd.setContrast(0.4);
+    init();
     
     while(true) {
-           // refresh the screen
-            lcd.clear();
-            
+          welcome();      
+    }
+}
 
-            Menu menu;
-            menu.startMainMenu(lcd);
-            
-            // lcd.drawLine(11, 47, 74, 45, 1);
-            lcd.refresh();
-            
-    }
+// initialies all classes and libraries
+void init()
+{
+    // need to initialise LCD and Gamepad 
+    lcd.init();
+    gamepad.init();
+
+    gamepad.leds_on();
+    lcd.setContrast(0.4);
+}
+
+void welcome() {
+    
+    Menu menu;   
+    menu.intro(lcd);
 }
\ No newline at end of file