ELEC2645 (2016/17) / Mbed 2 deprecated Bomb_WeixiTao_el16wt

Dependencies:   mbed

Committer:
weixitao
Date:
Wed Apr 26 16:38:33 2017 +0000
Revision:
0:1465fd20e75b
Child:
1:83459533ff72
four holes and treasure and man

Who changed what in which revision?

UserRevisionLine numberNew contents of line
weixitao 0:1465fd20e75b 1 #include "mbed.h"
weixitao 0:1465fd20e75b 2 #include "N5110.h"
weixitao 0:1465fd20e75b 3 #include "Gamepad.h"
weixitao 0:1465fd20e75b 4 #include "Treasure.h"
weixitao 0:1465fd20e75b 5 #include "hole.h"
weixitao 0:1465fd20e75b 6
weixitao 0:1465fd20e75b 7
weixitao 0:1465fd20e75b 8 N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
weixitao 0:1465fd20e75b 9 Gamepad pad;
weixitao 0:1465fd20e75b 10 Treasure treasure;
weixitao 0:1465fd20e75b 11 hole Blackhole;
weixitao 0:1465fd20e75b 12
weixitao 0:1465fd20e75b 13
weixitao 0:1465fd20e75b 14 int main()
weixitao 0:1465fd20e75b 15 {
weixitao 0:1465fd20e75b 16 lcd.init();
weixitao 0:1465fd20e75b 17 pad.init();
weixitao 0:1465fd20e75b 18 lcd.clear();
weixitao 0:1465fd20e75b 19 lcd.normalMode(); // normal colour mode
weixitao 0:1465fd20e75b 20 lcd.setBrightness(0.5); // put LED backlight on 50%
weixitao 0:1465fd20e75b 21 treasure.treasure_place();
weixitao 0:1465fd20e75b 22 Blackhole.hole_place();
weixitao 0:1465fd20e75b 23
weixitao 0:1465fd20e75b 24
weixitao 0:1465fd20e75b 25 while (1) {
weixitao 0:1465fd20e75b 26
weixitao 0:1465fd20e75b 27 if( pad.check_event(Gamepad::START_PRESSED) == true){
weixitao 0:1465fd20e75b 28 treasure.treasure_place();
weixitao 0:1465fd20e75b 29 Blackhole.hole_place();
weixitao 0:1465fd20e75b 30 lcd.clear();
weixitao 0:1465fd20e75b 31 lcd.refresh();
weixitao 0:1465fd20e75b 32 }
weixitao 0:1465fd20e75b 33 Blackhole.hole_show();
weixitao 0:1465fd20e75b 34 treasure.treasure_show();
weixitao 0:1465fd20e75b 35 lcd.drawRect(40,20,3,3,FILL_BLACK); //head
weixitao 0:1465fd20e75b 36 lcd.drawLine(41,23,41,26,1); //right hand
weixitao 0:1465fd20e75b 37 lcd.drawLine(40,26,42,26,1);// body2
weixitao 0:1465fd20e75b 38 lcd.drawLine(40,26,40,29,1);// body1
weixitao 0:1465fd20e75b 39 lcd.drawLine(42,26,42,29,1);// right leg
weixitao 0:1465fd20e75b 40 lcd.drawLine(38,24,42,24,1);//
weixitao 0:1465fd20e75b 41 lcd.drawLine(42,24,43,25,1);// right hand
weixitao 0:1465fd20e75b 42 lcd.drawLine(38,22,38,25,1);
weixitao 0:1465fd20e75b 43 lcd.drawLine(37,22,37,25,1);
weixitao 0:1465fd20e75b 44 lcd.refresh();
weixitao 0:1465fd20e75b 45
weixitao 0:1465fd20e75b 46
weixitao 0:1465fd20e75b 47
weixitao 0:1465fd20e75b 48
weixitao 0:1465fd20e75b 49 }
weixitao 0:1465fd20e75b 50 }