Peng Jingran
/
Snake_copy
ccc
main.cpp
- Committer:
- pjr
- Date:
- 2020-05-11
- Revision:
- 14:f898d37428b1
- Parent:
- 1:b34f1b9b2b62
File content as of revision 14:f898d37428b1:
#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,20,10); init_screen(); while (true) { snake.draw(lcd); snake.update(pad); } }//initialization void init_screen(){ lcd.printString("Peng Jingran",10,0); lcd.printString("201199511",20,2); lcd.printString("Press Start!!!",1,4); lcd.refresh();//print the information while ( pad.check_event(Gamepad::START_PRESSED) == false) { pad.leds_on(); wait(0.4); pad.leds_off(); wait(0.1); printf("Error"); } printf("start!!!");//condition of the unsuccesful login }