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.
Diff: main.cpp
- Revision:
- 37:ae343f310692
- Parent:
- 35:04699b49c463
diff -r 04699b49c463 -r ae343f310692 main.cpp
--- a/main.cpp Wed May 15 06:48:23 2019 +0000
+++ b/main.cpp Wed May 15 09:19:51 2019 +0000
@@ -70,14 +70,15 @@
switch(i) {
case 0://最初の直線
printf("go straight!!!!!!!!!!\r\n");
- motor_lo.setDutyLimit(0.7);
- motor_li.setDutyLimit(0.7);
+ motor_lo.setDutyLimit(0.6);
+ motor_li.setDutyLimit(0.6);
for(int i = 0; i < 30; i++) {
straightAndInfinity(0, 7);
}
printf("get distance mode");
for(int i=0; i<1; ++i) {
- while(Hcsr04BackWithEc() < 320) {//300
+// while(Hcsr04BackWithEc() < 320) {//300
+ while(get_dist_back() < 320) {//300
straightAndInfinity(0, 7);
}
}
@@ -88,17 +89,20 @@
if(RightOrLeft == 0) turn(35.0);
else turn(-35.0);
case 1://段差前
+ //段差前旋回
+ motor_lo.setDutyLimit(0.5);//0.5
+ motor_li.setDutyLimit(0.5);
printf("climb!!!!!!!!!!\r\n");
//段差乗り越え
- while(get_dist_forward() < 60) {
+ while(get_dist_forward() < 65) {
if(RightOrLeft == 0) straightAndInfinity(45, 5);
else straightAndInfinity(-45, 5);
}
if(RightOrLeft == 0) phasing(45.0);
else phasing(-45.0);
- motor_lo.setDutyLimit(0.3);//0.5
- motor_li.setDutyLimit(0.3);
+ motor_lo.setDutyLimit(0.2);//0.5
+ motor_li.setDutyLimit(0.2);
for(int i= 0; i<14; ++i) straight();
while(get_dist_back() > 80) straight();
@@ -112,8 +116,13 @@
case 2://段差直後
printf("go lope!!!!!!!!!!\r\n");
//前進
- motor_lo.setDutyLimit(0.7);
- motor_li.setDutyLimit(0.7);
+ motor_lo.setDutyLimit(0.6);
+ motor_li.setDutyLimit(0.6);
+ for(int i=0; i<12; ++i)
+ {
+ if(RightOrLeft == 0) straightAndInfinity(90.0, 7.0);
+ else straightAndInfinity(-90.0, 7.0);
+ }
for(int i=0; i<3; ++i) {
while(get_dist_forward() > 60) {
if(RightOrLeft == 0) straightAndInfinity(90.0, 7.0);
@@ -125,11 +134,11 @@
turn(0);
//ロープ位置ジャストまで前進
for(int i=0; i<3; ++i) {
- straightAndInfinity(0.0, 7.0);
+ straightAndInfinity(0, 7.0);
}
for(int i=0; i<2; ++i) {
while(get_dist_back() < 100) {
- straightAndInfinity(0.0, 7.0);
+ straightAndInfinity(0, 7.0);
}
}
phasing(0.0);
@@ -170,6 +179,11 @@
hand_mode = GOAL;
stop();
printf("uhai!!!!!!!!!!!!!!!/r/n");
+ for(int i=0;i<10;++i)
+ {
+ led1 = i%2;
+ wait(0.01);
+ }
}
}
void Start()