team3 / Mbed 2 deprecated PS3_BlueUSB_user_old

Dependencies:   mbed

Fork of PS3_BlueUSB_user by ROBOSTEP_SHARE

Files at this revision

API Documentation at this revision

Comitter:
yuji8822
Date:
Thu May 28 14:15:30 2015 +0000
Parent:
8:1d1b8298f0cd
Commit message:
User.cpp????????????

Changed in this revision

User.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/User.cpp	Wed May 27 10:31:05 2015 +0000
+++ b/User.cpp	Thu May 28 14:15:30 2015 +0000
@@ -8,8 +8,8 @@
 
 //ここに関数外に書く要素を記入する
 int RSX,RSY,LSX,LSY,BSU,BSL;
-PwmOut led1(LED1);
-PwmOut led2(LED2);
+//PwmOut led1(LED1);
+//PwmOut led2(LED2);
 
 DigitalOut led3(LED3);
 DigitalOut led4(LED4);
@@ -20,8 +20,9 @@
 PwmOut wheelL2(p23);
 PwmOut wheelL1(p24);
 
-DigitalOut launch1(p25);
-DigitalOut launch2(p26);
+PwmOut launch1(p25);
+PwmOut launch2(p26);
+
 
 void motorR(int dir,float dutyR)
 
@@ -67,14 +68,14 @@
             }
         
 }
-        
-    
-
+ 
+ 
 
 void UserLoopSetting()
 {
+    //led1.period_ms(20);
     //一度だけ行いたい初期設定をここに書く
-    led1.period_ms(20);
+    
 }
 
 void UserLoop(char n,const u8* data)
@@ -133,26 +134,47 @@
                 
     else if((ButtonState >> BUTTONR1)&1)
             {
-                motorL(1,0.3);
-                motorR(2,0.3);
+                motorL(1,0.6);
+                motorR(2,0.6);
             }
                     
     else if((ButtonState >> BUTTONL1)&1)
             {
-                motorL(2,0.3);
-                motorR(1,0.3);
+                motorL(2,0.6);
+                motorR(1,0.6);
+            }
+            
+    else if((ButtonState >> BUTTONSQUARE)&1)
+            {
+                launch1=0.9;
+                launch2=0;
+            }
+    
+    else if((ButtonState >> BUTTONCROSS)&1)
+            {
+                launch1=0;
+                launch2=0.9;
             }
             
-    else if((ButtonState >> BUTTONSQUARE) & 1)
-            {
-                launch1=1;
-                launch2=0;
-            }
-    else if((ButtonState >> BUTTONCROSS) & 1)
-            {
-                launch1=0;
-                launch2=1;
-            }
+    else if((ButtonState >> BUTTONCROSS)&1)   
+            { 
+                if((ButtonState >> BUTTONSQUARE)&1)
+                    {
+                        launch1=0;
+                        launch2=0;
+                    }                                 
+            } 
+            
+    else if((ButtonState >> BUTTONSQUARE)&1)  
+            { 
+                if((ButtonState >> BUTTONCROSS)&1)
+                    {
+                        launch1=0;
+                        launch2=0;
+                
+                    }
+            
+            }                            
         
         
  //ここより下にANALOGのプログラムを書く  
@@ -162,8 +184,8 @@
     else  if(LSX/256.0f>0.3 && LSX/256.0f<0.7 && LSY/256.0f<0.3 &&
              RSX/256.0f>0.3 && RSX/256.0f<0.7 && RSY/256.0f<0.3)
              {
-                motorR(1,0.5);
-                motorL(1,0.5);
+                motorR(1,0.9);
+                motorL(1,0.9);
              }
                                             
  //left down, right down
@@ -171,16 +193,16 @@
     else if(LSX/256.0f>0.3 && LSX/256.0f<0.7 && LSY/256.0f>0.7 &&
             RSX/256.0f>0.3 && RSX/256.0f<0.7 && RSY/256.0f>0.7)
             {
-                motorR(2,0.5);
-                motorL(2,0.5);
+                motorR(2,0.9);
+                motorL(2,0.9);
             }
                                           
 //  left up  , right down 
     else if(LSX/256.0f>0.3 && LSX/256.0f<0.7 && LSY/256.0f<0.3 &&
             RSX/256.0f>0.3 && RSX/256.0f<0.7 && RSY/256.0f>0.7)
             {
-                motorL(1,0.5);
-                motorR(2,0.5);
+                motorL(1,0.9);
+                motorR(2,0.9);
             }
                                                     
 // left down, right up
@@ -188,27 +210,21 @@
     else if(LSX/256.0f>0.3 && LSX/256.0f<0.7 && LSY/256.0f>0.7 &&
             RSX/256.0f>0.3 && RSX/256.0f<0.7 && RSY/256.0f<0.3)
             {
-                motorL(2,0.5);
-                motorR(1,0.5);
+                motorL(2,0.9);
+                motorR(1,0.9);
             }
-                                                        
-                                        
-                                        
                                         
                                        
     else    { 
                   motorL(0,0);
-                  motorR(0,0); 
+                  motorR(0,0);
+                  launch1=0;
+                  launch2=0;
             }
        
     
-                                
-                                
-                        
-                        
-        
-    led1=LSX/256.0f;
-    led2=LSY/256.0f;
+    //led1=LSX/256.0f;
+    //led2=LSY/256.0f;
     led3=ButtonState & 0x0400;  //L1の状態
     led4=ButtonState & 0x0800;  //R1の状態
     //値の取得はps3.hを参照