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@17:9f7ff626210b, 2019-05-09 (annotated)
- Committer:
- MYY
- Date:
- Thu May 09 05:08:02 2019 +0000
- Revision:
- 17:9f7ff626210b
- Parent:
- 11:ef3d6696ae84
Final submission, i guarantee there is no plagiarism in the project.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| MYY | 17:9f7ff626210b | 1 | /* |
| MYY | 17:9f7ff626210b | 2 | Yuyang Miao |
| MYY | 17:9f7ff626210b | 3 | 201089114 |
| MYY | 17:9f7ff626210b | 4 | Electrical and Electronic Engineering |
| MYY | 17:9f7ff626210b | 5 | Misery Miner |
| MYY | 17:9f7ff626210b | 6 | */ |
| MYY | 17:9f7ff626210b | 7 | |
| MYY | 7:8d63dc3948c1 | 8 | #include "Level.h" |
| MYY | 0:4ada39fe4ffc | 9 | |
| MYY | 17:9f7ff626210b | 10 | //objects |
| MYY | 0:4ada39fe4ffc | 11 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
| MYY | 9:03aa2479b941 | 12 | Menu Menu; |
| MYY | 7:8d63dc3948c1 | 13 | Level Level; |
| MYY | 0:4ada39fe4ffc | 14 | Rotate Rotate; |
| MYY | 1:7a3eed610fea | 15 | Release Release; |
| MYY | 4:b52a0d2925df | 16 | Detect detect; |
| MYY | 11:ef3d6696ae84 | 17 | Pull Pull; |
| MYY | 9:03aa2479b941 | 18 | logistic logistic; |
| MYY | 11:ef3d6696ae84 | 19 | Tool Tool; |
| MYY | 10:3ecbf164c0d3 | 20 | Image Image; |
| MYY | 0:4ada39fe4ffc | 21 | InterruptIn A(PTB9); |
| MYY | 9:03aa2479b941 | 22 | InterruptIn START(PTC5); |
| MYY | 1:7a3eed610fea | 23 | InterruptIn B(PTD0); |
| MYY | 9:03aa2479b941 | 24 | InterruptIn Back(PTB19); |
| MYY | 9:03aa2479b941 | 25 | Gamepad Gamepad; |
| MYY | 0:4ada39fe4ffc | 26 | |
| MYY | 17:9f7ff626210b | 27 | void init();//initialization lcd, gamepad, and debut value |
| MYY | 5:fe1f5b231446 | 28 | |
| MYY | 0:4ada39fe4ffc | 29 | int main() |
| MYY | 11:ef3d6696ae84 | 30 | { //initialize lcd, gamepad, and debut values |
| MYY | 11:ef3d6696ae84 | 31 | init(); |
| MYY | 9:03aa2479b941 | 32 | while(1) { |
| MYY | 11:ef3d6696ae84 | 33 | //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. |
| MYY | 9:03aa2479b941 | 34 | switch(level) { |
| MYY | 9:03aa2479b941 | 35 | case 1: |
| MYY | 11:ef3d6696ae84 | 36 | Level.level_1(Menu, Image, lcd, Rotate, Release, detect, Pull, START, B, Back, A, Gamepad, logistic, Level, Tool); |
| MYY | 9:03aa2479b941 | 37 | break; |
| MYY | 9:03aa2479b941 | 38 | |
| MYY | 9:03aa2479b941 | 39 | case 2: |
| MYY | 17:9f7ff626210b | 40 | Menu.TNT_m(lcd, A, B);//print Menu ask you if youwant to buy a TNT |
| MYY | 11:ef3d6696ae84 | 41 | Level.level_2(Image, lcd, Rotate, Release, detect, Pull, A, B, logistic, Level, Tool); |
| MYY | 9:03aa2479b941 | 42 | break; |
| MYY | 10:3ecbf164c0d3 | 43 | |
| MYY | 9:03aa2479b941 | 44 | case 3: |
| MYY | 9:03aa2479b941 | 45 | Menu.TNT_m(lcd, A, B); |
| MYY | 11:ef3d6696ae84 | 46 | Level.level_3(Image, lcd, Rotate, Release, detect, Pull, Gamepad, A, B, logistic, Level, Menu, Tool); |
| MYY | 10:3ecbf164c0d3 | 47 | break; |
| MYY | 9:03aa2479b941 | 48 | } |
| MYY | 0:4ada39fe4ffc | 49 | } |
| MYY | 0:4ada39fe4ffc | 50 | } |
| MYY | 0:4ada39fe4ffc | 51 | |
| MYY | 11:ef3d6696ae84 | 52 | void init() |
| MYY | 11:ef3d6696ae84 | 53 | { Gamepad.init(); |
| MYY | 11:ef3d6696ae84 | 54 | lcd.init(); |
| MYY | 11:ef3d6696ae84 | 55 | int ii; |
| MYY | 17:9f7ff626210b | 56 | for(ii=0; ii<3; ii=ii+1) {//set debut value |
| MYY | 11:ef3d6696ae84 | 57 | Rotate.return_angle[ii]=PI; |
| MYY | 11:ef3d6696ae84 | 58 | Rotate.return_flag[ii]=1; |
| MYY | 11:ef3d6696ae84 | 59 | } |
| MYY | 11:ef3d6696ae84 | 60 | Level.g_Start_flag=0; |
| MYY | 11:ef3d6696ae84 | 61 | Level.g_Back_flag=0; |
| MYY | 11:ef3d6696ae84 | 62 | Level.g_B_flag=0; |
| MYY | 11:ef3d6696ae84 | 63 | Level.detector=0; |
| MYY | 11:ef3d6696ae84 | 64 | } |