[[2006a/A1]] #contents *プログラム1(光センサ無し) [#q3184f68] **プログラム(1) [#qfb22c0a] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); task main() { ClearMessage(); until (Message() != 0); back(500);tomaru(500); SendMessage(1);Wait(300); if ( Message() == 2 ) { front(450);tomaru(200); front(200);tomaru(200); left(85);tomaru(200); front(250);left(85);tomaru(200); front(300);back(200); } } **プログラム(2)[#v15dec86] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); task main() { front(500);tomaru(200); front(200);tomaru(200); left(90);tomaru(200); front(250);left(90);tomaru(200); front(300);back(200);tomaru(200); left(90);tomaru(50);front(250);right(90);tomaru(50); front(700);tomaru(200);back(760);tomaru(200); right(90);tomaru(200);front(250);left(90);tomaru(200); front(300);back(200);tomaru(200); left(90);tomaru(50);front(250);right(90);tomaru(50); front(700);tomaru(200); } **プログラム(3) [#ecf68cbe] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+ OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); task main() { front(300);tomaru(150);right(80);tomaru(150); front(270);tomaru(150);right(80);tomaru(150); front(200);tomaru(100);back(200);tomaru(150); right(80);tomaru(150);front(270);tomaru(150); left(80);tomaru(150);front(450);tomaru(150); left(80);tomaru(150); front(300);tomaru(150);left(80);tomaru(150); front(300);tomaru(50);back(200);tomaru(150); left(80);tomaru(50);front(300);right(80);tomaru(50); front(400);tomaru(150);back(400);tomaru(150); right(80);tomaru(150);front(300);tomaru(150);left(80);tomaru(150); front(300);tomaru(50);back(200);tomaru(150); left(80);tomaru(50);front(300);tomaru(150);right(80);tomaru(50); front(400);tomaru(200); } **プログラム(4) [#b4aa91cd] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); task main() { while(true) { front(230);tomaru(150);back(500);tomaru(150); right(90);tomaru(150); front(330);tomaru(150);left(90);tomaru(150);front(300);tomaru(150); back(210);tomaru(150);left(76);tomaru(150);front (310);tomaru(150); right(76);tomaru(150);front(250);tomaru(150); } } **プログラム(5) [#ee0f1650] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); task main() { while(true) { front(230);tomaru(150);back(520);tomaru(150);front(50);tomaru(150); right(92);tomaru(150); front(300);tomaru(150);left(93);tomaru(150);front(340);tomaru(150); back(190);tomaru(150);left(81);tomaru(150);front(290);tomaru(150); right(81);tomaru(150);front(150);tomaru(100); front(250);tomaru(150); } } **プログラム(6) [#v791ee78] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); task main() { SetPower(OUT_A,6);SetPower(OUT_C,6); while(true) { tomaru(2000); front(150);tomaru(150);back(490);tomaru(150);front (50);tomaru(150); right(88);tomaru(150); front(300);tomaru(150);left(88);tomaru(150);front(340);tomaru(150); back(190);tomaru(150);left(77);tomaru(150);front(310);tomaru(150); right(77);tomaru(150);front(150);tomaru(100); front(250);tomaru(150); } } **プログラム(7) [#d2d07082] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); task main() { while(true) { front(150);tomaru(150);back(420);tomaru(150);front(50);tomaru(150); right(80);tomaru(150); front(300);tomaru(150);back(50);tomaru(50); left(83);tomaru(150);front(340);tomaru(150); back(190);tomaru(150);left(72);tomaru(150);front(280);tomaru(150); right(72);tomaru(150);front(230);tomaru(100); } } **プログラム(8) [#z9ae6497] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); task main() { repeat(2) { tomaru(2000); front(150);tomaru(150);back(420);tomaru(150);front(50);tomaru(150); right(80);tomaru(150); front(300);tomaru(150);back(50);tomaru(50); left(83);tomaru(150);front(250);right(30);left(60);right(30); front(100);tomaru(150); back(160);tomaru(150);left(72);tomaru(150);front(260);tomaru(150); right(71);tomaru(150);front(230);tomaru(100); } } *プログラム2(光センサ有り) [#r1120e17] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); #define THRESHOLD 43 task main() { SetSensor(SENSOR_1, SENSOR_LIGHT); SetSensor(SENSOR_2, SENSOR_LIGHT); while(true) { front(230);tomaru(150);back(530);tomaru(150); front(50);tomaru(50);right(88);tomaru(150); front(300);tomaru(150);left(88);tomaru(150);front(300);tomaru(150); back(190);tomaru(150);left(80);tomaru(150);front(310);tomaru(150); right(80);tomaru(150); if(SENSOR_1 <= THRESHOLD){tomaru(300);OnRev(OUT_C);OnFwd(OUT_A);} else{OnFwd(OUT_A+OUT_C);} if(SENSOR_2 <= THRESHOLD){tomaru(300);} front(250);tomaru(150); } } **プログラム(1) [#l56527f3] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off (OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); #define THRESHOLD 43 task main() { SetSensor(SENSOR_1, SENSOR_LIGHT); SetSensor(SENSOR_2, SENSOR_LIGHT); while(true) {if(SENSOR_1 <= THRESHOLD){tomaru(300);OnRev(OUT_C);OnFwd (OUT_A);} else{OnFwd(OUT_A+OUT_C);} if(SENSOR_2 <= THRESHOLD){tomaru(300);} front(250);tomaru(150); } } **プログラム(2) [#m8f02d09] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); #define THRESHOLD 40 task main() { SetSensor(SENSOR_1, SENSOR_LIGHT); SetSensor(SENSOR_2, SENSOR_LIGHT); while(true) { front(230);tomaru(150);back(520);tomaru(150);front(50);tomaru(50); right(100);tomaru(150); front(300);tomaru(150);left(93);tomaru(150);front(300);tomaru(150); back(190);tomaru(150);left(80);tomaru(150);front(310);tomaru(150); right(80);tomaru(150); while(true) { if((SENSOR_1 > THRESHOLD) && (SENSOR_2 > THRESHOLD)){OnFwd(OUT_A+OUT_C);} if(SENSOR_2 < THRESHOLD){OnRev(OUT_C);OnFwd(OUT_A);} if(SENSOR_1 < THRESHOLD){OnRev(OUT_A);OnFwd(OUT_C);} if((SENSOR_1 <= THRESHOLD) && (SENSOR_2 <= THRESHOLD)) {tomaru(200);front(50);} } front(250);tomaru(150); } } **プログラム(3) [#i88fa827] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); #define THRESHOLD 40 task main() { SetSensor(SENSOR_1, SENSOR_LIGHT); SetSensor(SENSOR_2, SENSOR_LIGHT); while(true) { front(230);tomaru(150);back(520);tomaru(150);front(50);tomaru(150); right(94);tomaru(150); front(300);tomaru(150);left(93);tomaru(150);front(340);tomaru(150); back(190);tomaru(150);left(80);tomaru(150);front(310);tomaru(150); right(80);tomaru(150);front(50);tomaru(100); while(true) { if((SENSOR_1 < THRESHOLD) && (SENSOR_2 < THRESHOLD)){OnFwd(OUT_A+OUT_C);} if(SENSOR_2 > THRESHOLD){OnRev(OUT_A);OnFwd(OUT_C);} if(SENSOR_1 > THRESHOLD){OnRev(OUT_C);OnFwd(OUT_A);} } if((SENSOR_1 >= THRESHOLD) && (SENSOR_2 >= THRESHOLD)){tomaru(200);front(50);} front(250);tomaru(150); } } *最終 [#jeaacd91] **試作1 [#zf4be09c] #define front(t) OnFwd(OUT_A+OUT_C);Wait(t); #define right(t) OnFwd(OUT_A);OnRev(OUT_C);Wait(t); #define left(t) OnFwd(OUT_C);OnRev(OUT_A);Wait(t); #define back(t) OnRev(OUT_A+OUT_C);Wait(t); #define up(t) OnFwd(OUT_B);Wait(t); #define down(t) OnRev(OUT_B);Wait(t); #define ACoff Off(OUT_A+OUT_C); #define Boff Off(OUT_B); #define ABCoff Off(OUT_A+OUT_B+OUT_C); task main() { SetSensor(SENSOR_2,SENSOR_TOUCH); SetSensor(SENSOR_3,SENSOR_TOUCH); SetPower(OUT_A,7); SetPower(OUT_C,7); SetPower(OUT_B,3); OnFwd(OUT_A+OUT_C); while (true) { if(SENSOR_2==1) { ACoff;down(100); right(50);ABCoff; front(50)ABCoff; Wait(100);up(150);Boff;Wait(100); back(140);left(15); OnFwd(OUT_A+OUT_C); while (true) { if(SENSOR_2==1) { ACoff; down(200);Boff; back(210); until (SENSOR_3==1); ACoff;Wait(100); front(15);ACoff;right(10);ACoff;Wait(200); up(200);Boff;right(50);ABCoff; Wait(100); back(20);ACoff; left(40);ACoff;Wait(200); front(100);up(10);Boff; OnFwd(OUT_A+OUT_C); while (true) { if(SENSOR_2==1) { ACoff; down(200);Boff; back(210); until (SENSOR_3==1); ACoff;Wait(100); front(15);ACoff;right(10);ACoff;Wait(200); up(200);Boff;right(50);ABCoff; Wait(100); back(20);ACoff; left(15);ACoff;Wait(200); OnFwd(OUT_A+OUT_C); while(true) { if(SENSOR_2==1) { down(20);back(100);ABCoff;Wait(200); up(100);Boff; } } } } } } } } } **2 [#cef3d51e] #define front(t) OnFwd(OUT_A+OUT_C);Wait(t); #define right(t) OnFwd(OUT_A);OnRev(OUT_C);Wait(t); #define left(t) OnFwd(OUT_C);OnRev(OUT_A);Wait(t); #define back(t) OnRev(OUT_A+OUT_C);Wait(t); #define up(t) OnFwd(OUT_B);Wait(t); #define down(t) OnRev(OUT_B);Wait(t); #define ACoff Off(OUT_A+OUT_C); #define Boff Off(OUT_B); #define ABCoff Off(OUT_A+OUT_B+OUT_C); task main() { SetSensor(SENSOR_2,SENSOR_TOUCH); SetSensor(SENSOR_3,SENSOR_TOUCH); SetPower(OUT_A,7); SetPower(OUT_C,7); SetPower(OUT_B,3); OnFwd(OUT_A+OUT_C); while (true) { if(SENSOR_2==1) { ACoff;down(100); right(45);ABCoff; front(50)ABCoff; Wait(100);up(150);Boff;Wait(100); back(120);left(14); OnFwd(OUT_A+OUT_C); while (true) { if(SENSOR_2==1) { ACoff; down(200);Boff; back(210); until (SENSOR_3==1); ACoff;Wait(100);down(25);Boff; right(10);ACoff;Wait(200); front(15);ACoff;Wait(10); up(250);Boff;right(70);ABCoff; Wait(100); up(20);left(70);ACoff;Wait(200); front(300);Boff; back(140);right(15);ACoff; back(120);right(20);ACoff; OnFwd(OUT_A+OUT_C); while (true) { if(SENSOR_2==1) { ACoff; down(450);Boff; back(210); until (SENSOR_3==1); ACoff;Wait(100); back(100);ACoff; front(15);ACoff;right(10);ACoff;Wait(200); up(200);Boff;right(50);ABCoff; Wait(100); back(24);ACoff; left(14);ACoff;Wait(200); OnFwd(OUT_A+OUT_C); while(true) { if(SENSOR_2==1) { down(50);back(100);ABCoff;Wait(200); up(100);Boff; } } } } } } } } } **3 [#v0dcc7e8] #define front(j) OnFwd(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define back(j) OnRev(OUT_A+OUT_C);Wait(j);Off(OUT_A+OUT_C); #define right(j) OnRev(OUT_C);OnFwd(OUT_A);Wait(j);Off(OUT_A+OUT_C); #define left(j) OnRev(OUT_A);OnFwd(OUT_C);Wait(j);Off(OUT_A+OUT_C); #define tomaru(j) Off(OUT_A+OUT_C);Wait(j); task main() { tomaru(2400); front(140);tomaru(150);back(395);tomaru(150);front(50);tomaru(150); right(80);tomaru(150); front(280);tomaru(150);back(50);tomaru(50); left(83);tomaru(150);front(250);right(30);left(60);right(30); front(100);tomaru(150); back(160);tomaru(150);left(71);tomaru(150);front(240);tomaru(150); right(71);tomaru(150);front(220);tomaru(100); front(165);tomaru(150);back(395);tomaru(150);front(50);tomaru(150); right(80);tomaru(150); front(280);tomaru(150);back(50);tomaru(50); left(83);tomaru(150);front(250);right(30);left(60);right(30); front(100);tomaru(150); back(160);tomaru(150);left(71);tomaru(150);front(240);tomaru(150); right(71);tomaru(150);front(220);tomaru(100); }