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:
- el17mcd
- Date:
- 2019-04-12
- Revision:
- 10:d4fb12e9e7cd
- Parent:
- 9:fe912235dd71
- Child:
- 11:4e2eb64031a0
File content as of revision 10:d4fb12e9e7cd:
/*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
Name: Maxim C. Delacoe
Username: EL 17 MCD
Student ID Number: 2011 58344
Date: 19/03/2019
*/
///////// pre-processor directives ////////
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "Bitmap.h"
#include "TankL.h"
#include "TanksEngine.h"
#include "Projectile.h"
#define PI 3.14159265
#define DEG2PI 0.0174532925
#include <cmath>
#ifdef WITH_TESTING
#endif
/////////////// objects ///////////////
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
TankL tankl;
Projectile proj;
TanksEngine engine;
void welcome()
{
lcd.clear();
lcd.printString(" ELEC 2645",0,0);
lcd.printString(" Game ",0,1);
lcd.printString(" Project",0,2);
lcd.printString("Max C. Delacoe",0,4);
lcd.printString(" 2011 58344",0,5);
lcd.refresh();
wait(0.2);
}
int main()
{
lcd.init();
float a;
float p;
int i = 0;
tankl.set_angle(0);
tankl.set_speed(4);
tankl.set_position(40-6, 0);
// welcome(); // display welcome message
while(1) { // infinite loop
lcd.clear();
tankl.draw(lcd);
lcd.refresh();
wait_ms(16.666);
a = 50 + 50 * sin((double)i/50);
p = 1.1*cos((double)i / 60);
tankl.set_angle(a);
tankl.move_position(p);
i++;
}
lcd.clear();
lcd.printString("DONE",0,1);
lcd.refresh();
wait(10);
}