[[2006a/C3/ロボコン]] int go_time; #define TURN_TIME 150 #define BACK_TIME 250 #define HOLD_TIME 30 #define PART_TIME 150 sub go_straight() { OnFwd(OUT_A+OUT_C);Wait(go_time);Off(OUT_A+OUT_C); } sub turn_right() { OnFwd(OUT_A);OnRev(OUT_C);Wait(TURN_TIME);Off(OUT_A+OUT_C); } sub turn_left() { OnRev(OUT_A);OnFwd(OUT_C);Wait(TURN_TIME);Off(OUT_A+OUT_C); } sub back_straight() { OnRev(OUT_A+OUT_C);Wait(BACK_TIME);Off(OUT_A+OUT_C); } sub hold_can() { OnFwd(OUT_B);Wait(HOLD_TIME);Off(OUT_B); } sub part_can() { OnRev(OUT_B);Wait(PART_TIME);Off(OUT_B); } task main() { SetSensor(SENSOR_1,SENSOR_LIGHT); SetSensor(SENSOR_3,SENSOR_LIGHT); while(true) { Wait(500); hold_can(); back_straight(); turn_right(); go_time=300; go_straight(); turn_left(); go_time=100; go_straight(); part_can(); go_time=100; go_straight(); back_straight(); turn_left(); go_time=300; go_straight(); turn_right(); go_time=100; go_straight(); } }