Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed move3wheel
Diff: User.cpp
- Revision:
- 21:0d063cc8b15f
- Parent:
- 20:18da3cef9b39
- Child:
- 22:b2237a179128
--- a/User.cpp Fri Sep 14 07:04:12 2018 +0000
+++ b/User.cpp Thu Nov 01 01:56:20 2018 +0000
@@ -79,13 +79,13 @@
//ボタンの処理
ButtonState = ((ps3report*)(data + 1))->ButtonState;
}
-
+
///////////////////////////RスティックとLスティックの値を入れかえる///////////////////
temp1 = LSX;
LSX = RSX;
RSX = temp1;
-
+
temp2 = LSY;
LSY = LSY;
RSY = temp2;
@@ -150,7 +150,7 @@
motor(0,GetMotorOut(0),GetMotorOut(1),0,GetMotorOut(2),0);
} else {
- motor(0,0,GetMotorOut(1),0,0,-GetMotorOut(2)); //1番motorはCW方向、2番motorはCCW方向に回す
+ motor(0,0,GetMotorOut(1),0,0,-GetMotorOut(2)-0.02); //1番motorはCW方向、2番motorはCCW方向に回す
}
@@ -175,7 +175,7 @@
motor(GetMotorOut(0),0,0,GetMotorOut(1),0,GetMotorOut(2));
} else {
- motor(0,0,0,GetMotorOut(1),-GetMotorOut(2),0); //前進と逆の方向に回す
+ motor(0,0,0,GetMotorOut(1),-GetMotorOut(2)-0.02,0); //前進と逆の方向に回す
}
@@ -327,18 +327,30 @@
} else {
motor(-GetMotorOut(0),0,0,-GetMotorOut(1),GetMotorOut(2),0);
- }
+ }
+ } else if ((ButtonState >> BUTTONR2)&1 == 1){
+ motor(0.3,0,0.3,0,0.3,0);
+ wait(0.5);
+
+ motor(0,0.3,0,0.3,0,0.3);
+ wait(0.5);
+
+ }else if((ButtonState >> BUTTONL2)&1 == 1){
+ motor(0,0,0.3,0,0,0.3);
+ wait(0.5);
+
+ motor(0,0,0,0.3,0.3,0);
+ wait(0.5);
}
-
////////////////////////////ここからヌクレオのプログラム/////////////////////////////
if((ButtonState >> BUTTONTRIANGEL)&1 == 1) { //servo1
wait(0.1);
if((ButtonState >> BUTTONTRIANGEL)&1 == 1) {
data1=1;
- printf("5");
+ //printf("5");
}
}
@@ -347,25 +359,27 @@
wait(0.1);
if((ButtonState >> BUTTONCIRCLE)&1 == 1) {
data1=2;
- printf("2");
+ //printf("2");
}
}
- if((ButtonState >> BUTTONCROSS)&1 == 1) { //servo3
+ if((ButtonState >> BUTTONCROSS)&1 == 1 ) { //servo3
wait(0.1);
- if((ButtonState >> BUTTONCROSS)&1 == 1) {
+ if((ButtonState >> BUTTONCROSS)&1 == 1 ) {
data1=3;
- printf("3");
+ //printf("3\r\n");
}
}
+
- if((ButtonState >> BUTTONSQUARE)&1 == 1) { //servo4
+
+ if((ButtonState >> BUTTONSQUARE)&1 == 1 ) { //servo4
wait(0.1);
- if((ButtonState >> BUTTONSQUARE)&1 == 1) {
+ if((ButtonState >> BUTTONSQUARE)&1 == 1 ) {
data1=4;
- printf("4");
+ //printf("4");
}
}
@@ -374,8 +388,8 @@
wait(0.1);
if((ButtonState >> BUTTONLEFT)&1 == 1) {
data1=5;
- printf("5");
-
+ //printf("5");
+
}
}