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
Diff: main.cpp
- Revision:
- 11:4e2eb64031a0
- Parent:
- 10:d4fb12e9e7cd
- Child:
- 12:9e6d5d0a0c82
--- a/main.cpp Fri Apr 12 12:01:47 2019 +0000
+++ b/main.cpp Sat Apr 13 16:31:43 2019 +0000
@@ -26,9 +26,8 @@
/////////////// objects ///////////////
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
-TankL tankl;
-Projectile proj;
TanksEngine engine;
+Gamepad pad;
void welcome()
{
@@ -45,36 +44,29 @@
int main()
{
lcd.init();
-
- float a;
- float p;
+ pad.init();
+ engine.initgame();
+ int fps = 60;
+ float frame_period_ms = 1000/fps;
- 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.clear();
+ if (engine.get_turn() == 1) {
+ engine.left_tank_turn(pad, lcd);
+ } else if (engine.get_turn() == 2) {
+ engine.projectile_phase(lcd);
+ } else { int turn = 3; }// means nothing
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);
+wait(10);*/
}