ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18s2a_2

Dependencies:   mbed

main.cpp

Committer:
Psy1990
Date:
2020-06-03
Revision:
2:c6772c5ab69d
Parent:
1:09a835e6d063
Child:
3:bd4c7eccde17

File content as of revision 2:c6772c5ab69d:

/* 
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
2019/20

Name: Simon Thackray Atkinson
Username: el18s2a   
Student ID Number: 201255483
Date: 05/03/2020
*/

///////// pre-processor directives ////////
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"



/////////////// structs /////////////////
struct UserInput {
    Direction d;
    float mag;
};
/////////////// objects ///////////////
N5110 lcd;
Gamepad pad;



void welcome();

///////////// functions ////////////////

int main()
{
    // first need to initialise display
    lcd.init();
    pad.leds_off();

     while ( pad.start_pressed() == false) { 
     
     pad.led(3,1);  // Only Show Green LEDS
     pad.led(6,1);  //
         
         // Splash Screen Info
   lcd.clear(); // we need to clear the screen first
   lcd.printString("    Author   ",0,1);  
   lcd.printString("Simon Atkinson",0,2); 
   lcd.printString("   201255483  ",0,3); 
   lcd.printString(" Uni of Leeds ",0,4); 
   lcd.refresh(); // need to refresh display after setting pixels or writing strings
           wait(1.0); // we don't want this screen on long!
            
       // main menu screen no interaction yet pressing start won't do anything but its a start if you pardon the pun!     
    lcd.clear();
    lcd.printString("  Welcome to  ",0,1);  
    lcd.printString("    Snake!   ",0,2); 
    lcd.printString("  Press Start ",0,4);
    lcd.refresh();
    wait(45.0);
    lcd.clear();
            
    // Easter Egg time! 
    lcd.printString("  Do you need  ",0,1);  
    lcd.printString("  more time?   ",0,2); 
    lcd.printString("  Grandpa! ",0,3);
    lcd.refresh();
    wait(5.0);
               
    //returns back to normal welcome screen           
    lcd.clear();
    lcd.printString("  Welcome to  ",0,1);  
    lcd.printString("    Snake!   ",0,2); 
    lcd.printString("  Press Start ",0,4);
    lcd.refresh();
             break;  //stops the loop
    
}

}