2018a/Member/hinagi/Mission3
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[2018a/Member]]
#ref(mission3_2.jpg)
#ref(mission3_3.jpg)
#ref(mission3_4.jpg)
#ref(mission3_5.jpg)
マスター
#define CONN 1//スレーブの番号を割り振り
#define AGERU RemoteStartProgram(CONN,"ageru.rxe");Wait(4500); //アームの上げるのを定義
#define SAGERU RemoteStartProgram(CONN,"sageru.rxe");Wait(3000); //アームの下げるのを定義
#define TUKAMU RemoteStartProgram(CONN,"tukamu.rxe");Wait(3500); //アームで掴むのを定義
#define HANASU RemoteStartProgram(CONN,"hanasu.rxe");Wait(3000); //アームで放すのを定義
#define MODOSU RemoteStartProgram(CONN,"modosu.rxe");Wait(3000); //アームを開きもとに戻す
#define KUZUSU TUKAMU;AGERU;OnRev(OUT_BC,10);Wait(1000);Off(OUT_BC);OnFwd(OUT_B,15);OnRev(OUT_C,15);Wait(1500);Off(OUT_BC);OnFwd(OUT_BC,10);Wait(1000);Off(OUT_BC);Wait(3000);SAGERU;HANASU;TUKAMU;AGERU;OnRev(OUT_BC,10);Wait(1000);Off(OUT_BC);OnFwd(OUT_C,15);OnRev(OUT_B,15);Wait(1600);Off(OUT_BC);OnFwd(OUT_BC,10);Wait(1300);Off(OUT_BC);Wait(1000);SAGERU;HANASU;
#define BLACK 40
#define LITTLE_BLACK 47
#define LITTLE_WHITE 53
#define WHITE 65
#define LEFT OnFwd(OUT_B,30);OnRev(OUT_C,30);Wait(1);Off(OUT_BC);
#define LITTLE_LEFT OnFwd(OUT_B,35);OnFwd(OUT_C,20);Wait(1);Off(OUT_BC);
#define LITTLE_RIGHT OnFwd(OUT_B,20);OnFwd(OUT_C,35);Wait(1);Off(OUT_BC);
#define RIGHT OnFwd(OUT_C,30);OnRev(OUT_B,30);Wait(1);Off(OUT_BC);
#define FRONT OnFwd(OUT_BC,25);Wait(1);Off(OUT_AC);
#define LINE_LEFT if (SENSOR_1 < BLACK) {LEFT;KAZU += 3;} else if (SENSOR_1 < LITTLE_BLACK) {LITTLE_LEFT;KAZU += 1;} else if (SENSOR_1 > WHITE) {RIGHT;KAZU -= 1;} else if (SENSOR_1 > LITTLE_WHITE) {LITTLE_RIGHT;KAZU -= 3;} else {FRONT;KAZU *= 0;}
#define LINE_RIGHT if (SENSOR_1 < BLACK) {RIGHT;KAZU += 3;} else if (SENSOR_1 < LITTLE_BLACK) {LITTLE_RIGHT;KAZU += 1;} else if (SENSOR_1 > WHITE) {LEFT;KAZU -= 1;}else if (SENSOR_1 > LITTLE_WHITE) {LITTLE_LEFT;KAZU -= 3;} else {FRONT;KAZU *= 0;}
task main() {
SetSensorLight(S1); //光センサを定義 int KAZU=0; int n = 0; long t0 = CurrentTick();
RemotePlayTone(1,440,1000);Wait(1500); //最初に音を鳴らす
MODOSU; //最初に念のため開いておく
while(n < 1){
if (SENSOR_1 < BLACK){OnFwd(OUT_C,25);OnFwd(OUT_B,20);Wait(700);Off(OUT_BC);n++;Off(OUT_BC);Wait(1);}
else {OnFwd(OUT_BC,20);Wait(1);Off(OUT_BC);}
}
n = 0; //黒を感知するまで進む//線を超えるために進む
while(n < 1){
if (SENSOR_1 < LITTLE_WHITE) {OnFwd(OUT_C,35);OnFwd(OUT_B,20);Wait(100);Off(OUT_BC);n++;Off(OUT_BC);Wait(1);}
else {OnFwd(OUT_B,40);OnFwd(OUT_C,20);Wait(1);Off(OUT_BC);}
}
n = 0; //黒を感知するまで曲がる
repeat(2000){LINE_RIGHT;};KAZU *= 0; while(KAZU < 300){LINE_RIGHT;};
PlaySound(SOUND_DOUBLE_BEEP); //十字の交差点を感知
OnFwd(OUT_C,30);OnRev(OUT_B,30);Wait(1200); //右に曲がる
OnFwd(OUT_BC,15);Wait(300);Off(OUT_BC);
repeat(2000){LINE_RIGHT;};KAZU *= 0; while(KAZU < 200){LINE_RIGHT;};
PlaySound(SOUND_DOUBLE_BEEP); //円との交差点を感知
KUZUSU; //缶を崩す
OnFwd(OUT_BC,15);Wait(200);Off(OUT_BC); OnRev(OUT_BC,15);Wait(200);Off(OUT_BC);
OnFwd(OUT_C,15);OnRev(OUT_B,30);Wait(200);Off(OUT_BC);
OnFwd(OUT_B,15);OnRev(OUT_C,15);Wait(200);Off(OUT_BC); //ぐちゃぐちゃやって整える
Wait(1000);
SAGERU;TUKAMU; //引きずるために掴む
Wait(2000);
OnFwd(OUT_B,40);OnFwd(OUT_C,30);Wait(3000);Off(OUT_BC); //円を超えるために進む
repeat(3000){LINE_RIGHT};KAZU *= 0; while(KAZU < 200){LINE_RIGHT};
PlaySound(SOUND_DOUBLE_BEEP); //十字の交差点を感知
/* OnFwd(OUT_C,20);OnRev(OUT_B,20);//右に曲がる Wait(2500); Off(OUT_BC);
repeat(1500){LINE_RIGHT}; KAZU *= 0; while(KAZU < 100){LINE_RIGHT};
PlaySound(SOUND_DOUBLE_BEEP);//十字の交差点を感知
while(n < 1){
if (SENSOR_1 < BLACK){OnFwd(OUT_BC,20);Wait(1);Off(OUT_BC);}
else{n++;Off(OUT_BC);Wait(1);}
}n = 0; //白を感知するまで進む OnFwd(OUT_BC,25); Wait(700); Off(OUT_BC); MODOSU;*/
/*TUKAMU;AGERU; OnRev(OUT_BC,20);Wait(2000);Off(OUT_BC); OnFwd(OUT_B,30);OnRev(OUT_C,30); Wait(1000); Off(OUT_BC); OnFwd(OUT_BC,20);Wait(2000);Off(OUT_BC); SAGERU;HANASU; TUKAMU;AGERU; OnRev(OUT_BC,20);Wait(2000);Off(OUT_BC); OnFwd(OUT_C,30);OnRev(OUT_B,30); Wait(1000); Off(OUT_BC); OnFwd(OUT_BC,20);Wait(2000);Off(OUT_BC); SAGERU;HANASU;MODOSU;*/
/*repeat(1000){LINE_RIGHT}; KAZU *= 0; while(KAZU < 100){LINE_RIGHT}; PlaySound(SOUND_DOUBLE_BEEP);//円との交差点を感知
}
はなす
task main(){ OnFwd(OUT_A,1c0); Wait(500); Off(OUT_A); }
苦し紛れにつくったやつ
#define CONN 1//スレーブの番号を割り振り
#define AGERU RemoteStartProgram(CONN,"ageru.rxe");Wait(4500); //アームの上げるのを定義
#define SAGERU RemoteStartProgram(CONN,"sageru.rxe");Wait(3000); //アームの下げるのを定義
#define TUKAMU RemoteStartProgram(CONN,"tukamu.rxe");Wait(3500); //アームで掴むのを定義
#define HANASU RemoteStartProgram(CONN,"hanasu.rxe");Wait(3000); //アームで放すのを定義
#define MODOSU RemoteStartProgram(CONN,"modosu.rxe");Wait(3000); //アームを開きもとに戻す
#define KUZUSU TUKAMU;AGERU;OnRev(OUT_BC,30);Wait(1000);Off(OUT_BC);OnFwd(OUT_B,30);OnRev(OUT_C,30);Wait(1500);Off(OUT_BC);OnFwd(OUT_BC,30);Wait(1000);Off(OUT_BC);Wait(3000);SAGERU;HANASU;TUKAMU;AGERU;OnRev(OUT_BC,30);Wait(1000);Off(OUT_BC);OnFwd(OUT_C,30);OnRev(OUT_B,30);Wait(2000);Off(OUT_BC);OnFwd(OUT_BC,30);Wait(1300);Off(OUT_BC);Wait(1000);SAGERU;
task main() { MODOSU; RemotePlayTone(1,440,1000);Wait(1500); //最初に音を鳴らす
OnFwd(OUT_BC,30); Wait(4000); Off(OUT_BC);
KUZUSU; //缶を崩す
OnFwd(OUT_BC,15);Wait(200);Off(OUT_BC); OnRev(OUT_BC,15);Wait(200);Off(OUT_BC);
OnFwd(OUT_C,15);OnRev(OUT_B,30);Wait(200);Off(OUT_BC);
OnFwd(OUT_B,15);OnRev(OUT_C,15);Wait(200);Off(OUT_BC); //ぐちゃぐちゃやって整える
SAGERU;TUKAMU; //引きずるために掴む
OnFwd(OUT_B,30); OnFwd(OUT_C,35); Wait(4000); Off(OUT_BC);
OnFwd(OUT_C,30); Wait(500); Off(OUT_C);
HANASU; MODOSU; }
上げる
task main(){
OnRev(OUT_BC,30);
OnRev(OUT_A,10);
Wait(8000);
}
戻す
task main(){
OnFwd(OUT_A,20);
Wait(1000);
Off(OUT_A);
}
下げる
task main(){
OnFwd(OUT_BC,20);
Wait(600);
Off(OUT_BC);
}
掴む
task main(){
OnRev(OUT_A,20);
Wait(1000);
}
終了行:
[[2018a/Member]]
#ref(mission3_2.jpg)
#ref(mission3_3.jpg)
#ref(mission3_4.jpg)
#ref(mission3_5.jpg)
マスター
#define CONN 1//スレーブの番号を割り振り
#define AGERU RemoteStartProgram(CONN,"ageru.rxe");Wait(4500); //アームの上げるのを定義
#define SAGERU RemoteStartProgram(CONN,"sageru.rxe");Wait(3000); //アームの下げるのを定義
#define TUKAMU RemoteStartProgram(CONN,"tukamu.rxe");Wait(3500); //アームで掴むのを定義
#define HANASU RemoteStartProgram(CONN,"hanasu.rxe");Wait(3000); //アームで放すのを定義
#define MODOSU RemoteStartProgram(CONN,"modosu.rxe");Wait(3000); //アームを開きもとに戻す
#define KUZUSU TUKAMU;AGERU;OnRev(OUT_BC,10);Wait(1000);Off(OUT_BC);OnFwd(OUT_B,15);OnRev(OUT_C,15);Wait(1500);Off(OUT_BC);OnFwd(OUT_BC,10);Wait(1000);Off(OUT_BC);Wait(3000);SAGERU;HANASU;TUKAMU;AGERU;OnRev(OUT_BC,10);Wait(1000);Off(OUT_BC);OnFwd(OUT_C,15);OnRev(OUT_B,15);Wait(1600);Off(OUT_BC);OnFwd(OUT_BC,10);Wait(1300);Off(OUT_BC);Wait(1000);SAGERU;HANASU;
#define BLACK 40
#define LITTLE_BLACK 47
#define LITTLE_WHITE 53
#define WHITE 65
#define LEFT OnFwd(OUT_B,30);OnRev(OUT_C,30);Wait(1);Off(OUT_BC);
#define LITTLE_LEFT OnFwd(OUT_B,35);OnFwd(OUT_C,20);Wait(1);Off(OUT_BC);
#define LITTLE_RIGHT OnFwd(OUT_B,20);OnFwd(OUT_C,35);Wait(1);Off(OUT_BC);
#define RIGHT OnFwd(OUT_C,30);OnRev(OUT_B,30);Wait(1);Off(OUT_BC);
#define FRONT OnFwd(OUT_BC,25);Wait(1);Off(OUT_AC);
#define LINE_LEFT if (SENSOR_1 < BLACK) {LEFT;KAZU += 3;} else if (SENSOR_1 < LITTLE_BLACK) {LITTLE_LEFT;KAZU += 1;} else if (SENSOR_1 > WHITE) {RIGHT;KAZU -= 1;} else if (SENSOR_1 > LITTLE_WHITE) {LITTLE_RIGHT;KAZU -= 3;} else {FRONT;KAZU *= 0;}
#define LINE_RIGHT if (SENSOR_1 < BLACK) {RIGHT;KAZU += 3;} else if (SENSOR_1 < LITTLE_BLACK) {LITTLE_RIGHT;KAZU += 1;} else if (SENSOR_1 > WHITE) {LEFT;KAZU -= 1;}else if (SENSOR_1 > LITTLE_WHITE) {LITTLE_LEFT;KAZU -= 3;} else {FRONT;KAZU *= 0;}
task main() {
SetSensorLight(S1); //光センサを定義 int KAZU=0; int n = 0; long t0 = CurrentTick();
RemotePlayTone(1,440,1000);Wait(1500); //最初に音を鳴らす
MODOSU; //最初に念のため開いておく
while(n < 1){
if (SENSOR_1 < BLACK){OnFwd(OUT_C,25);OnFwd(OUT_B,20);Wait(700);Off(OUT_BC);n++;Off(OUT_BC);Wait(1);}
else {OnFwd(OUT_BC,20);Wait(1);Off(OUT_BC);}
}
n = 0; //黒を感知するまで進む//線を超えるために進む
while(n < 1){
if (SENSOR_1 < LITTLE_WHITE) {OnFwd(OUT_C,35);OnFwd(OUT_B,20);Wait(100);Off(OUT_BC);n++;Off(OUT_BC);Wait(1);}
else {OnFwd(OUT_B,40);OnFwd(OUT_C,20);Wait(1);Off(OUT_BC);}
}
n = 0; //黒を感知するまで曲がる
repeat(2000){LINE_RIGHT;};KAZU *= 0; while(KAZU < 300){LINE_RIGHT;};
PlaySound(SOUND_DOUBLE_BEEP); //十字の交差点を感知
OnFwd(OUT_C,30);OnRev(OUT_B,30);Wait(1200); //右に曲がる
OnFwd(OUT_BC,15);Wait(300);Off(OUT_BC);
repeat(2000){LINE_RIGHT;};KAZU *= 0; while(KAZU < 200){LINE_RIGHT;};
PlaySound(SOUND_DOUBLE_BEEP); //円との交差点を感知
KUZUSU; //缶を崩す
OnFwd(OUT_BC,15);Wait(200);Off(OUT_BC); OnRev(OUT_BC,15);Wait(200);Off(OUT_BC);
OnFwd(OUT_C,15);OnRev(OUT_B,30);Wait(200);Off(OUT_BC);
OnFwd(OUT_B,15);OnRev(OUT_C,15);Wait(200);Off(OUT_BC); //ぐちゃぐちゃやって整える
Wait(1000);
SAGERU;TUKAMU; //引きずるために掴む
Wait(2000);
OnFwd(OUT_B,40);OnFwd(OUT_C,30);Wait(3000);Off(OUT_BC); //円を超えるために進む
repeat(3000){LINE_RIGHT};KAZU *= 0; while(KAZU < 200){LINE_RIGHT};
PlaySound(SOUND_DOUBLE_BEEP); //十字の交差点を感知
/* OnFwd(OUT_C,20);OnRev(OUT_B,20);//右に曲がる Wait(2500); Off(OUT_BC);
repeat(1500){LINE_RIGHT}; KAZU *= 0; while(KAZU < 100){LINE_RIGHT};
PlaySound(SOUND_DOUBLE_BEEP);//十字の交差点を感知
while(n < 1){
if (SENSOR_1 < BLACK){OnFwd(OUT_BC,20);Wait(1);Off(OUT_BC);}
else{n++;Off(OUT_BC);Wait(1);}
}n = 0; //白を感知するまで進む OnFwd(OUT_BC,25); Wait(700); Off(OUT_BC); MODOSU;*/
/*TUKAMU;AGERU; OnRev(OUT_BC,20);Wait(2000);Off(OUT_BC); OnFwd(OUT_B,30);OnRev(OUT_C,30); Wait(1000); Off(OUT_BC); OnFwd(OUT_BC,20);Wait(2000);Off(OUT_BC); SAGERU;HANASU; TUKAMU;AGERU; OnRev(OUT_BC,20);Wait(2000);Off(OUT_BC); OnFwd(OUT_C,30);OnRev(OUT_B,30); Wait(1000); Off(OUT_BC); OnFwd(OUT_BC,20);Wait(2000);Off(OUT_BC); SAGERU;HANASU;MODOSU;*/
/*repeat(1000){LINE_RIGHT}; KAZU *= 0; while(KAZU < 100){LINE_RIGHT}; PlaySound(SOUND_DOUBLE_BEEP);//円との交差点を感知
}
はなす
task main(){ OnFwd(OUT_A,1c0); Wait(500); Off(OUT_A); }
苦し紛れにつくったやつ
#define CONN 1//スレーブの番号を割り振り
#define AGERU RemoteStartProgram(CONN,"ageru.rxe");Wait(4500); //アームの上げるのを定義
#define SAGERU RemoteStartProgram(CONN,"sageru.rxe");Wait(3000); //アームの下げるのを定義
#define TUKAMU RemoteStartProgram(CONN,"tukamu.rxe");Wait(3500); //アームで掴むのを定義
#define HANASU RemoteStartProgram(CONN,"hanasu.rxe");Wait(3000); //アームで放すのを定義
#define MODOSU RemoteStartProgram(CONN,"modosu.rxe");Wait(3000); //アームを開きもとに戻す
#define KUZUSU TUKAMU;AGERU;OnRev(OUT_BC,30);Wait(1000);Off(OUT_BC);OnFwd(OUT_B,30);OnRev(OUT_C,30);Wait(1500);Off(OUT_BC);OnFwd(OUT_BC,30);Wait(1000);Off(OUT_BC);Wait(3000);SAGERU;HANASU;TUKAMU;AGERU;OnRev(OUT_BC,30);Wait(1000);Off(OUT_BC);OnFwd(OUT_C,30);OnRev(OUT_B,30);Wait(2000);Off(OUT_BC);OnFwd(OUT_BC,30);Wait(1300);Off(OUT_BC);Wait(1000);SAGERU;
task main() { MODOSU; RemotePlayTone(1,440,1000);Wait(1500); //最初に音を鳴らす
OnFwd(OUT_BC,30); Wait(4000); Off(OUT_BC);
KUZUSU; //缶を崩す
OnFwd(OUT_BC,15);Wait(200);Off(OUT_BC); OnRev(OUT_BC,15);Wait(200);Off(OUT_BC);
OnFwd(OUT_C,15);OnRev(OUT_B,30);Wait(200);Off(OUT_BC);
OnFwd(OUT_B,15);OnRev(OUT_C,15);Wait(200);Off(OUT_BC); //ぐちゃぐちゃやって整える
SAGERU;TUKAMU; //引きずるために掴む
OnFwd(OUT_B,30); OnFwd(OUT_C,35); Wait(4000); Off(OUT_BC);
OnFwd(OUT_C,30); Wait(500); Off(OUT_C);
HANASU; MODOSU; }
上げる
task main(){
OnRev(OUT_BC,30);
OnRev(OUT_A,10);
Wait(8000);
}
戻す
task main(){
OnFwd(OUT_A,20);
Wait(1000);
Off(OUT_A);
}
下げる
task main(){
OnFwd(OUT_BC,20);
Wait(600);
Off(OUT_BC);
}
掴む
task main(){
OnRev(OUT_A,20);
Wait(1000);
}
ページ名: