a

Dependencies:   Locate Move Servo button mbed

Fork of 3servotest by 涼太郎 中村

main.cpp

Committer:
choutin
Date:
2016-09-09
Revision:
15:92b8d8d0f139
Parent:
14:0629ab54765c

File content as of revision 15:92b8d8d0f139:

#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=team*1200,goaly2=team*900,goaly3=team*600,goaly4=team*300;
    
//オブジェクト0,1,2回収
       pmove(targetx[0],0);
       pmove(targetx[0],targety[0]);
       //回収
       pmove(targetx[1],targety[1]-20);
       //回収
       pmove(targetx[2],targety[2]-20);
       //回収
       
       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();
       /**********************/
       


}