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@2:8382613c86a0, 2019-04-01 (annotated)
- Committer:
- el17mcd
- Date:
- Mon Apr 01 11:50:07 2019 +0000
- Revision:
- 2:8382613c86a0
- Child:
- 3:087b28bf8b96
Tank Sprite prototype
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el17mcd | 2:8382613c86a0 | 1 | /* |
| el17mcd | 2:8382613c86a0 | 2 | ELEC2645 Embedded Systems Project |
| el17mcd | 2:8382613c86a0 | 3 | School of Electronic & Electrical Engineering |
| el17mcd | 2:8382613c86a0 | 4 | University of Leeds |
| el17mcd | 2:8382613c86a0 | 5 | Name: Maxim C. Delacoe |
| el17mcd | 2:8382613c86a0 | 6 | Username: EL 17 MCD |
| el17mcd | 2:8382613c86a0 | 7 | Student ID Number: 2011 58344 |
| el17mcd | 2:8382613c86a0 | 8 | Date: 19/03/2019 |
| el17mcd | 2:8382613c86a0 | 9 | */ |
| el17mcd | 2:8382613c86a0 | 10 | ///////// pre-processor directives //////// |
| el17mcd | 2:8382613c86a0 | 11 | #include "mbed.h" |
| el17mcd | 2:8382613c86a0 | 12 | #include "Gamepad.h" |
| el17mcd | 2:8382613c86a0 | 13 | #include "N5110.h" |
| el17mcd | 2:8382613c86a0 | 14 | #include "Bitmap.h" |
| el17mcd | 2:8382613c86a0 | 15 | |
| el17mcd | 2:8382613c86a0 | 16 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
| el17mcd | 2:8382613c86a0 | 17 | |
| el17mcd | 2:8382613c86a0 | 18 | const int tank_left[6][10] = { |
| el17mcd | 2:8382613c86a0 | 19 | { 0,0,0,1,1,1,0,0,0,0 }, |
| el17mcd | 2:8382613c86a0 | 20 | { 0,0,1,1,1,1,1,0,0,0 }, |
| el17mcd | 2:8382613c86a0 | 21 | { 0,0,1,1,1,1,1,1,1,0 }, |
| el17mcd | 2:8382613c86a0 | 22 | { 1,1,1,1,1,1,1,1,1,1 }, |
| el17mcd | 2:8382613c86a0 | 23 | { 1,0,1,0,1,0,1,0,1,0 }, |
| el17mcd | 2:8382613c86a0 | 24 | { 0,1,0,1,0,1,0,1,0,0 }, |
| el17mcd | 2:8382613c86a0 | 25 | }; |
| el17mcd | 2:8382613c86a0 | 26 | |
| el17mcd | 2:8382613c86a0 | 27 | void welcome() |
| el17mcd | 2:8382613c86a0 | 28 | { |
| el17mcd | 2:8382613c86a0 | 29 | lcd.clear(); |
| el17mcd | 2:8382613c86a0 | 30 | lcd.printString(" ELEC 2645",0,0); |
| el17mcd | 2:8382613c86a0 | 31 | lcd.printString(" Game ",0,1); |
| el17mcd | 2:8382613c86a0 | 32 | lcd.printString(" Project",0,2); |
| el17mcd | 2:8382613c86a0 | 33 | lcd.printString("Max C. Delacoe",0,4); |
| el17mcd | 2:8382613c86a0 | 34 | lcd.printString(" 2011 58344",0,5); |
| el17mcd | 2:8382613c86a0 | 35 | lcd.refresh(); |
| el17mcd | 2:8382613c86a0 | 36 | wait(0.2); |
| el17mcd | 2:8382613c86a0 | 37 | } |
| el17mcd | 2:8382613c86a0 | 38 | |
| el17mcd | 2:8382613c86a0 | 39 | int main() |
| el17mcd | 2:8382613c86a0 | 40 | { |
| el17mcd | 2:8382613c86a0 | 41 | lcd.init(); |
| el17mcd | 2:8382613c86a0 | 42 | welcome(); // display welcome message |
| el17mcd | 2:8382613c86a0 | 43 | |
| el17mcd | 2:8382613c86a0 | 44 | while(1) { // infinite loop |
| el17mcd | 2:8382613c86a0 | 45 | |
| el17mcd | 2:8382613c86a0 | 46 | lcd.clear(); |
| el17mcd | 2:8382613c86a0 | 47 | lcd.drawSprite(2,40-6,6,10,(int *)tank_left); |
| el17mcd | 2:8382613c86a0 | 48 | lcd.refresh(); |
| el17mcd | 2:8382613c86a0 | 49 | wait_ms(250); |
| el17mcd | 2:8382613c86a0 | 50 | } |
| el17mcd | 2:8382613c86a0 | 51 | } |
| el17mcd | 2:8382613c86a0 | 52 |