task main() { #define MOVE_TIME OnFwd (OUT_A+OUT_C); Wait(300); Off(OUT_C); Wait(220); OnFwd(OUT_C); Wait(300); Off(OUT_C); Wait(220); OnFwd(OUT_C); Wait(300); Off(OUT_A+OUT_C); }
#define up(j) OnFwd(OUT_B);Wait(j);Off(OUT_B);Wait(t); //ペンを上げる #define down(j) OnRev(OUT_B);Wait(j);Off(OUT_B);Wait(t); //ペンを下げる #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 p 10 #define t 30 task main() { front(75);up(p);tomaru(200); //1画目 left(137);tomaru(200);front(50);tomaru(200); //2画目へ移動 left(117);tomaru(200);down(p);front(90);tomaru(200); //2画目 up(p);back(58);tomaru(30);tomaru(200); //3画目へ移動 right(41);front(5);down(p);front(49);up(p);tomaru(200); //3画目 back(54);tomaru(200); //4画目へ移動 left(82);front(7);down(p);front(49); //4画目 tomaru(200);up(p); //終了 }
#define right(s) OnRev(OUT_C);OnFwd(OUT_A);Wait(s); #define left(s) OnRev(OUT_A);OnFwd(OUT_C);Wait(s); task main() { SetSensor(SENSOR_1,SENSOR_TOUCH); SetSensor(SENSOR_2,SENSOR_TOUCH); OnFwd(OUT_A+OUT_C); while(true) { until((SENSOR_1==1) || (SENSOR_2==1)); OnRev(OUT_A+OUT_C);Wait(150); right(83); OnFwd(OUT_A+OUT_C); until((SENSOR_1==1) || (SENSOR_2==1)); OnRev(OUT_A+OUT_C);Wait(150); right(83); OnFwd(OUT_A+OUT_C); } }
#define THRESHOLD 40
#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 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); task main () {
SetSensor(SENSOR_1, SENSOR_LIGHT); SetSensor(SENSOR_2, SENSOR_LIGHT); SetSensor(SENSOR_3, SENSOR_TOUCH); while (true) { if (SENSOR_1< THRESHOLD) { OnFwd(OUT_A); Off(OUT_C);} if (SENSOR_2< THRESHOLD) { OnFwd(OUT_C); Off(OUT_A);} if (SENSOR_1 && SENSOR_2> THRESHOLD) { OnFwd(OUT_A); OnFwd(OUT_C);} else { Off(OUT_A); Off(OUT_C); until (SENSOR_3 == 1); back(50); right(55); front(200); } } }
task main() { #define turn_time 360; int time_max; int light_max; ClearTimer(0); SetSensor(SENSOR_1,SENSOR_LIGHT); time_max=0; light_max=0; while(FastTimer(0)<TURNTIME){ if(SENSOR_1>light_max){ light_max=SENSOR_1; time_max=FastTimer(0);} }
製作者:シュート・アップル
#define front OnFwd(OUT_A+OUT_C); #define right OnRev(OUT_C);OnFwd(OUT_A); #define left OnRev(OUT_A);OnFwd(OUT_C); #define minus 15 int light_max; int time_max; task main() { SetSensor(SENSOR_1,SENSOR_LIGHT); light_max=SENSOR_1; time_max=Timer(0); ClearTimer(0); while(Timer(0)<=14) { right if(SENSOR_1>light_max) { ClearTimer(1); light_max =SENSOR_1 ; } else { light_max = light_max; time_max =Timer(1); } } ClearTimer(1); while(Timer(1)<= time_max) {left} while(true) { if(SENSOR_1>= light_max-minus) {front} if(SENSOR_1< light_max-minus) { right ClearTimer(2); until((SENSOR_1>= light_max-minus)||(Timer(2)==5)); } if(SENSOR_1< light_max-minus) { left until(SENSOR_1>= light_max-minus); } } }
製作者:シュート・アップル
#define front OnFwd(OUT_A+OUT_C); #define right OnRev(OUT_C);OnFwd(OUT_A); #define TURN_TIME 360 #define Do 1047 #define Re 1175 #define Mi 1319 #define Fa 1397 #define So 784 #define Ra 880 #define Si 988 task play_music() { while (true) { PlayTone(Mi,25); Wait(30); PlayTone(Re, 5); Wait(10); PlayTone(Do,15); Wait(20); PlayTone(Re,15); Wait(20);
PlayTone(Mi,15); Wait(20); PlayTone(Mi,15); Wait(20); PlayTone(Mi,35); Wait(40);
PlayTone(Re,15); Wait(20); PlayTone(Re,15); Wait(20); PlayTone(Re,35); Wait(40);
PlayTone(Mi,15); Wait(20); PlayTone(Sol,15); Wait(20); PlayTone(Sol,35); Wait(40);
PlayTone(Mi,25); Wait(30); PlayTone(Re, 5); Wait(10); PlayTone(Do,15); Wait(20); PlayTone(Re,15); Wait(20);
PlayTone(Mi,15); Wait(20); PlayTone(Mi,15); Wait(20); PlayTone(Mi,35); Wait(40);
PlayTone(Re,15); Wait(20); PlayTone(Re,15); Wait(20); PlayTone(Mi,25); Wait(30); PlayTone(Re, 5); Wait(10);
PlayTone(Do,55); Wait(60); Wait(20); } } int Light=0; int turn_time=360; task main() { SetSensor(SENSOR_1,SENSOR_LIGHT); ClearTimer(0); while(Timer(0)<=turn_time) { if(SENSOR_1>Light) { Light=SENSOR_1; } right } right start play_music; until(SENSOR_1>=Light); while(true) { if(SENSOR_1<Light) { right until(SENSOR_1>=Light); } else { front stop play_music; until(SENSOR_1<Light); } } }
製作者:シュート・アップル
#define front OnFwd(OUT_A+OUT_C); #define right OnRev(OUT_C);OnFwd(OUT_A); #define TURN_TIME 360 #define Do 1047 #define Re 1175 #define Mi 1319 #define Fa 1397 #define So 784 #define Ra 880 #define Si 988 task play_music() { while (true) { PlayTone(Mi,25); Wait(30); PlayTone(Re, 5); Wait(10); PlayTone(Do,15); Wait(20); PlayTone(Re,15); Wait(20);
PlayTone(Mi,15); Wait(20); PlayTone(Mi,15); Wait(20); PlayTone(Mi,35); Wait(40);
PlayTone(Re,15); Wait(20); PlayTone(Re,15); Wait(20); PlayTone(Re,35); Wait(40);
PlayTone(Mi,15); Wait(20); PlayTone(So,15); Wait(20); PlayTone(So,35); Wait(40);
PlayTone(Mi,25); Wait(30); PlayTone(Re, 5); Wait(10); PlayTone(Do,15); Wait(20); PlayTone(Re,15); Wait(20);
PlayTone(Mi,15); Wait(20); PlayTone(Mi,15); Wait(20); PlayTone(Mi,35); Wait(40);
PlayTone(Re,15); Wait(20); PlayTone(Re,15); Wait(20); PlayTone(Mi,25); Wait(30); PlayTone(Re, 5); Wait(10);
PlayTone(Do,55); Wait(60); Wait(20); } } int Light=0; int turn_time=360; task main() { SetSensor(SENSOR_1,SENSOR_LIGHT); ClearTimer(0); while(Timer(0)<=turn_time) { if(SENSOR_1>Light) { Light=SENSOR_1; } right } right start play_music; until(SENSOR_1>=Light); while(true) { if(SENSOR_1<Light) { right until(SENSOR_1>=Light); } if(SENSOR_1>=75) { Off(OUT_A+OUT_C); } else { front stop play_music; until(SENSOR_1<Light); } } }