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: Alpha_Movements BoolProcess DataCaller MD_PID mbed angle
Fork of 2017_Bteam_alpha_master by
Diff: main.cpp
- Revision:
- 10:94527f9ac652
- Parent:
- 8:701a9c23b517
--- a/main.cpp Thu Sep 21 05:21:14 2017 +0000
+++ b/main.cpp Wed Sep 27 06:50:34 2017 +0000
@@ -6,28 +6,36 @@
#include "ArrowShooter.h"
+#include "ShooterAngle.h"
+
#include "2017_4.h"
#define SDA PB_7
#define SCL PB_6
+
I2C *master;
DataPool *alpha;
Mecanamu_4 Mecanamu(PA_8, PB_0, PA_12, PA_7, PA_11, PB_1, PA_6, PA_5, PB_5, PF_0, PA_4, PA_3, PB_4, PF_1, PA_1, PA_0, 1);
+
Serial pc(USBTX, USBRX);
double fire_work_time;
int fire_work_allow = 0;
+const int angle_max = 57;
+const int angle_min = 22;
+
int main()
{
master = new I2C(SDA, SCL);
alpha = new AlphaTransporter(master);
ArrowShooter shooter(master);
+ ShooterAngle angle(master, angle_max, angle_min);
- Mecanamu.Drive(0, 0, 0);
- float x, y, t;
+ Mecanamu.Drive(0, 0, 0, 0);
+ float a, x, y, t;
while(1)
{
alpha->set();
@@ -44,12 +52,15 @@
if(fire_work_time >= 3.7)
fire_work_allow = 0;
+ a = alpha->read(3);
x = alpha->read(0) / 128.00;
y = alpha->read(1) / 128.00;
t = alpha->read(2) / 128.00;
- Mecanamu.Drive(x, y, t);
+
+ Mecanamu.Drive(1, x, y, t);
+
wait(0.01);
-
+ angle.setAngle(alpha->read(17));
//printf("%lf, %lf, %lf\r\n", x, y, t);
}
}
