ライントレースするロボットです。 黒線上を進み、黒線から外れると警告として音を鳴らしながら曲がり、黒線に戻れな ければゆっくりと停止するようにしました。 tameshi8でライトセンサーの練習 tameshi9‐1で黒線上の移動の練習 tameshi9‐2で待ち時間の指定の調整を行いました。 [[tameshi8>2004/C5/tameshi8]] [[tameshi9-1>2004/C5/tameshi9-1]] [[tameshi9-2>2004/C5/tameshi9-2]] -[[tameshi8>2004/C5/tameshi8]] -[[tameshi9-1>2004/C5/tameshi9-1]] -[[tameshi9-2>2004/C5/tameshi9-2]] /*tameshi9-3*/ #define THRESHOLD 70 #define RUN_TIME 100 task main() { SetSensor(SENSOR_1,SENSOR_LIGHT); ClearTimer(0); while(Timer(0)<=RUN_TIME) { if(SENSOR_1<=THRESHOLD) { OnFwd(OUT_A+OUT_C); } else { OnFwd(OUT_A); } PlaySound(SOUND_FAST_UP) ; Wait(600); Float(OUT_A+OUT_C); } }