めいん

Dependencies:   mbed

Revision:
1:a1e592eca305
Parent:
0:df2659fd8031
Child:
2:b204cf2f9b60
Child:
3:3a1b0dda8c6c
--- a/main.cpp	Sun Aug 28 17:03:34 2016 +0000
+++ b/main.cpp	Tue Aug 30 06:51:41 2016 +0000
@@ -2,8 +2,22 @@
 
 #include"header.h"
 
+int team;//(-1)は青
+
 int main(void){
     
+    teamSW.mode(PullUp); 
+    if(teamSW){
+        team=1;
+        teamledred=1;
+        teamledblue=0;
+    }else{
+        team=-1;
+        teamledred=0;
+        teamledblue=1;
+    }
+    initmotor();
+    initencorder();
     
     move(0,0);
     close_arm();
@@ -16,7 +30,7 @@
     //オブジェクトの位置
     //原点はスタートゾーンの中心
     int targetx[9] = { 600,600,600,1200,900,1200,900,1200,900 };
-    int targety[9] = { blue()*300,blue()*600,blue()*900,blue()*1200,blue()*900,blue()*600,blue()*600,0,blue()*300 };
+    int targety[9] = { team*300,team*600,team*900,team*1200,team*900,team*600,team*600,0,team*300 };
     
     //ハブの位置
     int hub1x = 600;
@@ -26,7 +40,7 @@
     int hub2y = 0;
 
 
-    int goalx = 0, goaly = blue()*1200;//受け渡しゾーンの中心
+    int goalx = 0, goaly = team*1200;//受け渡しゾーンの中心
     //定義終了
     
     int retry=0;        
@@ -123,7 +137,7 @@
     
             back();
     
-            moveto(1800,blue()*1200);//invade
+            moveto(1800,team*1200);//invade
     
             return 0;//終了
     }