マザー 20151028 PS3

Dependencies:   mbed

Fork of Nucleo_PS3_Jikken3 by 2015 robotic contest arakawa A

Revision:
24:ee0943b12feb
Parent:
23:d5f7e3dab589
--- a/main.cpp	Fri Oct 23 10:21:57 2015 +0000
+++ b/main.cpp	Wed Oct 28 09:18:09 2015 +0000
@@ -23,7 +23,7 @@
 #define TNL 150
 #define debugFlag 1
 #define stopCount 33
-#define shotWait 0.3
+#define shotWait 0.5
 
 Serial pc(SERIAL_TX, SERIAL_RX);
 //Serial Dev(D8,D2);//コントローラー
@@ -225,7 +225,8 @@
 
 int main() { 
     pc.baud(230400);
-    Dev.baud(921600);
+    Dev.baud(921600);//PS3
+    //Dev.baud(115200);//XBOX
     Mechanum.baud(230400);
     DigitalIn bt(USER_BUTTON);
     Dev.attach(num,Serial::RxIrq);//受信割り込み設定
@@ -263,6 +264,7 @@
                 
             //射出
             if(l){
+                //pc.printf("L\r\n");
                 pushF=true;
                 kRed=shotToDenziben(airReg,1,1,airAddr);
                 wait(shotWait);
@@ -272,6 +274,7 @@
             
             //射出
             else if(r){
+                //pc.printf("R\r\n");
                 pushF=true;
                 kRed=shotToDenziben(airReg,2,1,airAddr);
                 wait(shotWait);
@@ -283,6 +286,7 @@
             
             //射出
             else if(t){
+                //pc.printf("T\r\n");
                 pushF=true;
                 kRed=shotToDenziben(airReg,4,1,airAddr);
                 wait(shotWait);
@@ -304,17 +308,18 @@
         //タッチセンサ
         if(((int)DATA[1]&12)==12&&!touchSF){
             touchSF=true;
-            gValue=0.8;
+            gValue=0.5;
         }
-        else if(!((int)DATA[1]&12)==12){
+        else if(!(((int)DATA[1]&12)==12)){
             touchSF=false;
-            gValue=0;bValue=0.8;
+            gValue=0;
         }
         //お盆回し
         if(getPress(presUp)){
+            //pc.printf("L\r\n");
             obonFlag=true;
             Mechanum.putc(162);
-            rValue=0.8;
+            rValue=0.5;
             kRed=0;
             wait(0.2);
         }
@@ -345,6 +350,7 @@
         else
             stopCounter++;
         Mechanum.putc(val);
+        //bValue=0.8;
         setFCLED(rValue,gValue,bValue);
         wait(0.03f);
         do{
@@ -353,7 +359,8 @@
             //pc.printf("%d\r\n",DATA[6]);
             //if(getPress(btSel))
             //    pc.printf("up\r\n");
-            //pc.printf("val:%d\r\n",val);
+            pc.printf("val:%d\r\n",val);
+            pc.printf("a");
             //printf("%lf:%d:%d\r\n",deg,(int)DATA[3],(int)DATA[2]);
             //printf("%d\r\n",(int)DATA[0]);
             //pc.printf("DATA[1]%d\r\n",(int)(DATA[1]&0x02));