ももいくん
Dependencies: mbed
Fork of 2016_Sp_momoi_0611 by
Revision 14:caab74db0c6d, committed 2016-10-21
- Comitter:
- abcdefgh
- Date:
- Fri Oct 21 08:17:51 2016 +0000
- Parent:
- 13:9e04b53e875a
- Commit message:
- a
Changed in this revision
momoi_taka.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9e04b53e875a -r caab74db0c6d momoi_taka.cpp --- a/momoi_taka.cpp Fri Jun 10 17:27:13 2016 +0000 +++ b/momoi_taka.cpp Fri Oct 21 08:17:51 2016 +0000 @@ -8,6 +8,9 @@ int RSX,RSY,LSX,LSY,BSU,BSL; //これより下に関数外に書く要素を記入する double flag; + +int a; +int b; //MD1 PwmOut motorRightOne (p23); PwmOut motorRightTwo (p24); @@ -93,32 +96,27 @@ */ //motor - if((ButtonState >> BUTTONSTART)&1 == 1) { - flag = 0; + if((ButtonState >> BUTTONL2)&1 == 1) { + flag -= 0.10; + wait(0.1); } else if((ButtonState >> BUTTONR2)&1 == 1) { - flag += 0.05; - wait(0.1); - } else if((ButtonState >> BUTTONL2)&1 == 1) { - flag -= 0.05; + flag = 0; wait(0.1); } - if(flag >= 1.0) { - flag = 1.0; - } - if(flag <= -0.3) { - flag = -0.2; + if(flag <= -0.4) { + flag = -0.4; } if(LSY>140 && ((ButtonState >> BUTTONLANALOG)&1) == 1) { - motorRightOne = 0.8; + motorRightOne = 0.9; motorRightTwo = 0; - motorLeftOne = 0.8; + motorLeftOne = 0.9; motorLeftTwo = 0; } else if(LSY<110 && ((ButtonState >> BUTTONLANALOG)&1) == 1) { motorRightOne = 0; - motorRightTwo = 0.8; + motorRightTwo = 0.9; motorLeftOne = 0; - motorLeftTwo = 0.8; + motorLeftTwo = 0.9; } else if( LSY > 140 ) { //forward motorRightOne = 0.6 + flag; motorRightTwo = 0; @@ -139,8 +137,8 @@ if(( ButtonState >> BUTTONR1)&1 == 1) { motorRightOne = 0; - motorRightTwo = 0.7 + flag; - motorLeftOne = 0.7 + flag; + motorRightTwo = 0.6 + flag; + motorLeftOne = 0.6 + flag; motorLeftTwo = 0; } if(( ButtonState >> BUTTONL1)&1 == 1) { @@ -156,18 +154,20 @@ armThree = 0; armFour = 1; armLeft = 0.4; + } else if( (ButtonState >> BUTTONCROSS)&1 == 1 ) { armThree = 1; armFour = 0; armLeft = 0.4; + } else { armThree = 0; armFour = 0; armLeft = 0; - + } - - if((ButtonState >> BUTTONSQUARE)&1 == 1) { + + if((ButtonState >> BUTTONSQUARE)&1 == 1) { armOne = 1; armTwo = 0; armRight = 0.4; @@ -179,22 +179,23 @@ armOne = 0; armTwo = 0; armRight = 0; - - /* - With oen if, put both arms and legs. - - Use start and select?? + } - */ + /* + With oen if, put both arms and legs. + + Use start and select?? + + + */ - /* - led3=ButtonState & 0x0400; //L1の状態 - led4=ButtonState & 0x0800; //R1の状態 - */ //値の取得はps3.hを参照 + /* + led3=ButtonState & 0x0400; //L1の状態 + led4=ButtonState & 0x0800; //R1の状態 + */ //値の取得はps3.hを参照 - } } \ No newline at end of file