Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include <math.h> 00002 #include <stdlib.h> 00003 #include "Gamepad.h" 00004 #include "mbed.h" 00005 #include "N5110.h" 00006 #include "Snake.h" 00007 //libraries including 00008 00009 struct UserInput { 00010 Direction d; 00011 00012 }; 00013 00014 Gamepad pad; 00015 Snake snake; 00016 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);//hardware used lcd and pad 00017 00018 void init_screen(); 00019 00020 int main() 00021 { 00022 lcd.init(); 00023 pad.init(); 00024 00025 snake.init(25,25,20,10); 00026 init_screen(); 00027 00028 while (true) { 00029 00030 snake.draw(lcd); 00031 snake.update(pad); 00032 00033 } 00034 }//initialization 00035 00036 00037 void init_screen(){ 00038 00039 lcd.printString("Peng Jingran",10,0); 00040 lcd.printString("201199511",20,2); 00041 lcd.printString("Press Start!!!",1,4); 00042 lcd.refresh();//print the information 00043 00044 while ( pad.check_event(Gamepad::START_PRESSED) == false) { 00045 pad.leds_on(); 00046 wait(0.4); 00047 pad.leds_off(); 00048 wait(0.1); 00049 printf("Error"); 00050 } 00051 printf("start!!!");//condition of the unsuccesful login 00052 } 00053
Generated on Mon Jul 18 2022 14:19:10 by
