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:
- 9:fe912235dd71
- Parent:
- 8:d4e419dad90f
- Child:
- 10:d4fb12e9e7cd
--- a/main.cpp Wed Apr 10 11:33:10 2019 +0000
+++ b/main.cpp Wed Apr 10 14:27:37 2019 +0000
@@ -43,29 +43,19 @@
int main()
{
lcd.init();
- int p_pos_x = 0;
- int p_pos_y = 0;
- int time = 0;
- float lnch_ang = 70.0; //in degrees
- float init_vel = 1.3;
- float init_x = 0;
- float init_y = 0;
- float grav_acc = 0.02;
- float wind_acc = 0;
+ proj.set_launch_parameters(0, 4, 6, 45, 1.3, 0.02, 0.01);
+
//tankl.set_health(1);
// welcome(); // display welcome message
while(1) { // infinite loop
- p_pos_x = 10 + init_vel * time * cos(lnch_ang * DEG2PI) - 0.5 * wind_acc * time * time;
- p_pos_y = 6 + init_vel * time * sin(lnch_ang * DEG2PI) - 0.5 * grav_acc * time * time;
- time++;
- proj.set_position(p_pos_x, p_pos_y);
- if (p_pos_x < -3 || p_pos_x > 87 || p_pos_y < -3) {break;}
+ proj.update_flight();
lcd.clear();
proj.draw(lcd);
lcd.refresh();
- wait_ms(50);
+ wait_ms(50);
+ if (proj.check_boundaries() == true) {break;}
}
lcd.clear();
lcd.printString("DONE",0,1);