Du Xianjie 201089059

Dependencies:   mbed FXOS8700Q

main.cpp

Committer:
VivianDu
Date:
2019-05-06
Revision:
13:9a6aff771774
Parent:
1:b34f1b9b2b62

File content as of revision 13:9a6aff771774:

#include <math.h>
#include <stdlib.h>
#include "Gamepad.h"
#include "mbed.h"
#include "N5110.h"
#include "Snake.h"
//libraries including

struct UserInput {
    Direction d;
   
};

Gamepad pad;
Snake snake;
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);//hardware used lcd and pad

void init_screen();

int main()
{
    lcd.init();
    pad.init();
   
    snake.init(25,25,5,3);
    init_screen();
    
    while (true) {
            
            snake.draw(lcd);
            snake.update(pad);
        
    }
}//initialization


void init_screen(){
        
    lcd.printString("Du Xianjie 201089059",0,1);  
    lcd.printString("Press Start!!!",0,4);
    lcd.refresh();//print the information 
    
    while ( pad.check_event(Gamepad::START_PRESSED) == false) {
        pad.leds_on();
        wait(0.1);
        pad.leds_off();
        wait(0.1);
        printf("Error");
    }
    printf("start!!!");//condition of the unsuccesful login
}