a

Dependencies:   Locate Move Servo button mbed

Fork of 4thcomp by 涼太郎 中村

main.cpp

Committer:
choutin
Date:
2016-09-08
Revision:
14:0629ab54765c
Parent:
12:456d651ef4f0
Child:
15:a2cdcb373d3d

File content as of revision 14:0629ab54765c:

#include "mbed.h"
#include "math.h"
#include "locate.h"
#include "move.h"
#include "servo.h"
#include "button.h"


int main()
{
    int team=1;
    setup();
    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;
    
//オブジェクト0,1,2回収
       pmove(targetx[0],0);
       pmove(targetx[0],targety[0]);
       //回収
       pmove(targetx[1],targety[1]);
       //回収
       pmove(targetx[2],targety[2]);
       //回収
       
       pmove(600,1200);//次につなげるハブ
       
       pmove(goalx,goaly1);
       //リリース
       back300();//(300,1200)なう
       /****************/
       
       //オブジェクト3,4回収
       pmove(targetx[3],targety[3]);
       //回収
       pmove(1200,900);//ハブ
       pmove(targetx[4],targety[4]);
       //回収?
       pmove(goalx,goaly2);
       //リリース
       back300();
       /***************/
       
       //オブジェクト5,6回収
       pmove(1200,900);//ハブ
       pmove(targetx[5],targety[5]);
       //回収
       pmove(targetx[6],targety[6]);
       //回収?
       pmove(goalx,goaly3);
       //リリース
       back300();
       /**********************/
       
       //オブジェクト7,8回収
       pmove(300,0);//ハブ
       pmove(targetx[7],targety[7]);
       //回収
       pmove(1200,300);//ハブ
        pmove(targetx[8],targety[8]);
       //回収?
       pmove(goalx,goaly4);
       //リリース
       back300();
       /**********************/
       


}