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.
Dependencies: mbed
main.cpp
- Committer:
- MYY
- Date:
- 2019-05-09
- Revision:
- 17:9f7ff626210b
- Parent:
- 11:ef3d6696ae84
File content as of revision 17:9f7ff626210b:
/*
Yuyang Miao
201089114
Electrical and Electronic Engineering
Misery Miner
*/
#include "Level.h"
//objects
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
Menu Menu;
Level Level;
Rotate Rotate;
Release Release;
Detect detect;
Pull Pull;
logistic logistic;
Tool Tool;
Image Image;
InterruptIn A(PTB9);
InterruptIn START(PTC5);
InterruptIn B(PTD0);
InterruptIn Back(PTB19);
Gamepad Gamepad;
void init();//initialization lcd, gamepad, and debut value
int main()
{ //initialize lcd, gamepad, and debut values
init();
while(1) {
//this switch decides which level you are at, whenever you finish one level, you can break and change the value of variable "value". So switch can transfer you to another level.
switch(level) {
case 1:
Level.level_1(Menu, Image, lcd, Rotate, Release, detect, Pull, START, B, Back, A, Gamepad, logistic, Level, Tool);
break;
case 2:
Menu.TNT_m(lcd, A, B);//print Menu ask you if youwant to buy a TNT
Level.level_2(Image, lcd, Rotate, Release, detect, Pull, A, B, logistic, Level, Tool);
break;
case 3:
Menu.TNT_m(lcd, A, B);
Level.level_3(Image, lcd, Rotate, Release, detect, Pull, Gamepad, A, B, logistic, Level, Menu, Tool);
break;
}
}
}
void init()
{ Gamepad.init();
lcd.init();
int ii;
for(ii=0; ii<3; ii=ii+1) {//set debut value
Rotate.return_angle[ii]=PI;
Rotate.return_flag[ii]=1;
}
Level.g_Start_flag=0;
Level.g_Back_flag=0;
Level.g_B_flag=0;
Level.detector=0;
}