[[2014a/Member]] 目次 [#i8abe013] #contents * メンバー紹介[#f5b97111] gamigami (自分) ラインのトレースを頑張った。 gomibakudan (協力した仲間) *課題の説明 [#r3df13cf] 詳しくは[[2014a/Mission1]]をご覧ください *ロボットの紹介 [#kb75725f] *プログラム [#o2155e95] #define THRESHOLD 36 #define sp_H SetPower(OUT_AC,7); #define sp_L SetPower(OUT_AC,2); #define go sp_H; OnFwd(OUT_AC); #define turn_left1 sp_L; OnFwd(OUT_C); OnRev(OUT_A) #define turn_left0 sp_L; OnFwd(OUT_C); Off(OUT_A) #define turn_right1 sp_L; OnFwd(OUT_A); OnRev(OUT_C); #define turn_right0 sp_L; OnFwd(OUT_A); Off(OUT_C); #define STEP 1 #define nMAX 10 #define short_break Off(OUT_AC); Wait(100); #define CROSS_TIME 50 #define cross_line sp_L; OnFwd(OUT_AC); Wait(CROSS_TIME); #define turn_time 60 #define the_time 16 task main() { SetSensor(SENSOR_2,SENSOR_LIGHT); int online=0; int next=0; Off(OUT_B); go; Wait(100); while(true) { while (online < nMAX) { if (SENSOR_2 < THRESHOLD - 5){ turn_left1; online++; } else if (SENSOR_2 < THRESHOLD - 1) { turn_left0; online=0; } else if (SENSOR_2 < THRESHOLD + 2) { go; online=0; } else if (SENSOR_2 < THRESHOLD + 5) { turn_right0; online=0; } else if (SENSOR_2 < THRESHOLD +100) { turn_right1; online=0; } Wait(STEP); } if (next < 1 ) { PlaySound(SOUND_UP); Wait(5); turn_left1; Wait(50); next++; online=0; } else if (next == 1 ) { turn_right1; Wait(turn_time); OnFwd(OUT_B);Wait(the_time); Off(OUT_B); cross_line; online=0; next++; } else if (next == 2 ){ turn_right1; Wait(55); OnFwd(OUT_AC); Wait(10); online=0; next++; } else if (next == 3 ) { PlaySound(SOUND_DOWN); Wait(5); turn_left1; Wait(50); next++; online=0; } else if(next == 4) { turn_right1; Wait(turn_time - 15); cross_line; online=0; next++; } else if (next == 5 ) { PlaySound(SOUND_UP); Wait(5); turn_left1; Wait(50); next++; online=0; } else if(next == 6) { PlaySound(SOUND_UP); OnRev(OUT_B); Wait(the_time); Off(OUT_B); OnFwd(OUT_AC); Wait(90); next++; } Off(OUT_AC); } } **写真の添付 [#kb99a448] 添付 参照 アップロード ページ名を打ちこむ ・&を使うときは後ろにセミコロン ・#のときはいらない ・画像を並べるときは& **プログラム [#p8e75004] ・行の一番最初に半角のスペースを入れる ・コメント文などで説明をする(特に変数は必要)