a
Dependencies: Locate Move Servo button mbed
Fork of 3rdcompfixstart by
Diff: main.cpp
- Revision:
- 15:a2cdcb373d3d
- Parent:
- 14:0629ab54765c
- Child:
- 16:a9885a66048f
--- a/main.cpp Thu Sep 08 10:08:17 2016 +0000 +++ b/main.cpp Fri Sep 09 05:41:41 2016 +0000 @@ -5,6 +5,9 @@ #include "servo.h" #include "button.h" +const int dist=30; +const int slidedist=150; +const int space=100; int main() { @@ -13,8 +16,8 @@ initmotor(); int targetx[9] = { 600,600,600,1200,900,1200,900,1200,900 }; - int targety[9] = { team*300,team*600,team*900,team*1200,team*900,team*600,team*600,0,team*300 }; - int goalx=0,goaly1=1200,goaly2=900,goaly3=600,goaly4=300; + int targety[9] = { team*(300+slidedist),team*(600+slidedist),team*(900+slidedist),team*(1200+slidedist),team*(900+slidedist),team*(600+slidedist),team*(600+slidedist),team*(0+slidedist),team*(300+slidedist) }; + int goalx=0,goaly1=1200+150,goaly2=900+slidedist,goaly3=600+slidedist,goaly4=300+slidedist; //オブジェクト0,1,2回収 pmove(targetx[0],0); @@ -25,7 +28,7 @@ pmove(targetx[2],targety[2]); //回収 - pmove(600,1200);//次につなげるハブ + pmove(600,1200+slidedist);//次につなげるハブ pmove(goalx,goaly1); //リリース @@ -33,9 +36,9 @@ /****************/ //オブジェクト3,4回収 - pmove(targetx[3],targety[3]); + pmove(targetx[3]+space,targety[3]); //回収 - pmove(1200,900);//ハブ + pmove(1200+space,900+slidedist);//ハブ pmove(targetx[4],targety[4]); //回収? pmove(goalx,goaly2); @@ -43,25 +46,30 @@ back300(); /***************/ - //オブジェクト5,6回収 - pmove(1200,900);//ハブ + //オブジェクト5,7回収 + pmove(1200,900+slidedist);//ハブ pmove(targetx[5],targety[5]); //回収 - pmove(targetx[6],targety[6]); + pmove(targetx[7],targety[7]); //回収? - pmove(goalx,goaly3); + pmove(600,0+slidedist); //リリース + pmove(600,1200+slidedist);//ハブ + + pmove(goalx,goaly1); back300(); /**********************/ - //オブジェクト7,8回収 - pmove(300,0);//ハブ - pmove(targetx[7],targety[7]); + //オブジェクト6,8回収 + pmove(300,0+slidedist);//ハブ + pmove(900,0+slidedist);//ハブ + pmove(targetx[8],targety[8]); //回収 - pmove(1200,300);//ハブ - pmove(targetx[8],targety[8]); + pmove(targetx[6],targety[6]); + //回収 + pmove(900,1200+slidedist); //回収? - pmove(goalx,goaly4); + pmove(goalx,goaly1); //リリース back300(); /**********************/