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 KondoServoLibrary Encoder
Diff: User.cpp
- Revision:
- 23:0c6bc29c8f86
- Parent:
- 22:f0e17f3129cc
- Child:
- 24:674b011da45b
diff -r f0e17f3129cc -r 0c6bc29c8f86 User.cpp
--- a/User.cpp Fri Mar 13 08:15:38 2020 +0000
+++ b/User.cpp Fri Mar 13 08:23:05 2020 +0000
@@ -38,7 +38,8 @@
int id = 0;
int id2 = 1;
double SERVO2DEG = 270.0 / (11500 - 3500);
-double first = (6800 - 3500) * SERVO2DEG;
+double first_ball = (6800 - 3500) * SERVO2DEG;
+double first_box = (X - 3500) * SERVO2DEG; //X haven't be decided
double grab_ball = (3600 - 3500) * SERVO2DEG;
double pass = (5000 - 3500) * SERVO2DEG;
double grab_box = (3550 - 3500) * SERVO2DEG;
@@ -233,24 +234,24 @@
switch (ball) {
case 1: //ball servo
if(ball_count ==0) {
- servo.set_degree(id, first);
+ servo.set_degree(id, first_ball);
wait(0.5);
- shoot =0;
- ball = 1;
+ ball_count =1;
+ ball = 0;
} else if(ball_count ==1) {
servo.set_degree(id, grab_ball);
wait(0.5);
- shoot = 0;
+ ball_count = 0;
ball =0;
}
break;
case 2://ball air
if (out1==0) {
out1=1;
- shoot=0;
+ ball=0;
} else if (out1 == 1) {
out1=0;
- shoot=0;
+ ball=0;
}
}
}
@@ -260,24 +261,23 @@
switch(box) {
case 1:// box servo
if(box_count ==0) {
- servo.set_degree(id2, first);
+ servo.set_degree(id2, first_box);
wait(0.5);
- shoot =0;
- ball = 1;
+ box_count =1;
+ box = 1;
} else if(box_count ==1) {
servo.set_degree(id2, grab_box);
wait(0.5);
- shoot = 0;
- ball =0;
+ box_count = 0;
+ box =0;
}
case 2: //box air
if (out3==0) {
out3=1;
- shoot = 0;
+ box = 0;
} else if (out3 == 1) {
out3=0;
- shoot = 0;
+ box = 0;
}
}
-
}
\ No newline at end of file