Peng Jingran
/
Snake_copy
ccc
main.cpp
- Committer:
- VivianDu
- Date:
- 2019-05-05
- Revision:
- 1:b34f1b9b2b62
- Parent:
- 0:bc1d36f5f772
- Child:
- 14:f898d37428b1
File content as of revision 1:b34f1b9b2b62:
#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 }