/* 前進/後退 : OUT_A */ /* アーム制御 : OUT_B */ /* ペンの上下 : OUT_C */ #define UNITTIME 13 #define pen_down_wait2(s,t) OnRev(OUT_A+OUT_B); Wait(s); Off(OUT_A+OUT_B); OnFwd(OUT_C); Wait(t); OnFwd(OUT_A+OUT_B); Wait(s); Off(OUT_A+OUT_B); Wait(50); #define pen_down_wait OnFwd(OUT_C); Wait(100) #define pen_up OnRev(OUT_C) #define pen_up_wait OnRev(OUT_C); Wait(100) #define move_left(t) Off(OUT_A); OnRev(OUT_B); Wait(UNITTIME*t) #define move_right(t) Off(OUT_A); OnFwd(OUT_B); Wait(UNITTIME*t) #define move_up(t) OnRev(OUT_A); Off(OUT_B); Wait(UNITTIME*t) #define move_down(t) OnFwd(OUT_A); Off(OUT_B); Wait(UNITTIME*t) #define move_leftup(t) OnRev(OUT_A); OnRev(OUT_B); Wait(UNITTIME*t) #define move_leftdown(t) OnFwd(OUT_A); OnRev(OUT_B); Wait(UNITTIME*t) #define move_rightup(t) OnRev(OUT_A); OnFwd(OUT_B); Wait(UNITTIME*t) #define move_rightdown(t) OnFwd(OUT_A); OnFwd(OUT_B); Wait(UNITTIME*t) #define move_wait(t) Wait(UNITTIME*t) #define move_stop Off(OUT_A); Off(OUT_B) #define move_left_stop(t) Off(OUT_A); OnRev(OUT_B); Wait(UNITTIME*t); move_stop #define move_right_stop(t) Off(OUT_A); OnFwd(OUT_B); Wait(UNITTIME*t); move_stop #define move_up_stop(t) OnRev(OUT_A); Off(OUT_B); Wait(UNITTIME*t); move_stop #define move_down_stop(t) OnFwd(OUT_A); Off(OUT_B); Wait(UNITTIME*t); move_stop #define move_leftup_stop(t) OnRev(OUT_A); OnRev(OUT_B); Wait(UNITTIME*t); move_stop #define move_leftdown_stop(t) OnFwd(OUT_A); OnRev(OUT_B); Wait(UNITTIME*t); move_stop #define move_rightup_stop(t) OnRev(OUT_A); OnFwd(OUT_B); Wait(UNITTIME*t); move_stop #define move_rightdown_stop(t) OnFwd(OUT_A); OnFwd(OUT_B); Wait(UNITTIME*t); move_stop task main() { SetPower(OUT_A,1); SetPower(OUT_B,7); SetPower(OUT_C,2); // 達 - 1 pen_down_wait; move_right_stop(4); pen_up_wait; // 達 - 2 move_leftup(1); move_left_stop(1); pen_down_wait; move_down_stop(2); pen_up_wait; // 達 - 3 move_left_stop(3); pen_down_wait; move_right_stop(6); pen_up_wait; // 達 - 4 move_leftdown(1); move_left_stop(4); pen_down_wait; move_rightdown_stop(1); pen_up_wait; // 達 - 5 move_rightup(1); move_right_stop(2); pen_down_wait; move_leftdown_stop(1); pen_up_wait; // 達 - 6 move_left_stop(4); pen_down_wait; move_right_stop(6); pen_up_wait; // 達 - 7 move_leftdown(1); move_left_stop(4); pen_down_wait; move_right_stop(4); pen_up_wait; // 達 - 8 move_leftdown(1); move_left_stop(4); pen_down_wait; move_right_stop(6); pen_up_wait; // 達 - 9 move_leftup(2); move_left_stop(1); pen_down_wait; move_down_stop(5); pen_up_wait; // 達 - しんにょう1 move_leftup(6); move_up_stop(2); pen_down_wait; move_rightdown_stop(2); pen_up_wait; // 達 - しんにょう2 move_leftdown(1); move_left_stop(2); pen_down_wait; move_right_stop(3); pen_up; move_wait(1); move_leftdown_stop(2); pen_down_wait; move_right_stop(2); pen_up; move_wait(1); move_leftdown_stop(2); pen_up_wait; // 達 - しんにょう3 move_leftup_stop(1); pen_down_wait; move_rightdown(3); move_right(3); pen_up; move_right_stop(5); pen_up_wait; // 移動 move_leftdown(2); move_left_stop(6); // 筆 - 竹冠1 pen_down_wait; pen_up; move_leftdown_stop(3); pen_up_wait; // 筆 - 竹冠2 move_rightup_stop(2); pen_down_wait; move_right_stop(2); pen_up_wait; // 筆 - 竹冠3 move_left_stop(1); pen_down_wait; move_down_stop(1); pen_up_wait; // 筆 - 竹冠4 move_rightup(2); move_right_stop(2); pen_down_wait; pen_up; move_leftdown_stop(3); pen_up_wait; // 筆 - 竹冠5 move_rightup_stop(2); pen_down_wait; move_right_stop(2); pen_up_wait; // 筆 - 竹冠6 move_left_stop(1); pen_down_wait; move_down_stop(1); pen_up_wait; // 筆 - 下の部分1 move_leftdown(1); move_left_stop(4); pen_down_wait; move_right_stop(4); move_wait(1); move_down_stop(2); pen_up_wait; // 筆 - 下の部分2 move_leftup(1); move_left_stop(4); pen_down_wait; move_right_stop(6); pen_up_wait; // 筆 - 下の部分3 move_leftdown(1); move_left_stop(4); pen_down_wait; move_right_stop(4); pen_up_wait; // 筆 - 下の部分4 move_leftdown(1); move_left_stop(3); pen_down_wait; move_right_stop(4); pen_up_wait; // 筆 - 下の部分5 move_leftdown(1); move_left_stop(5); pen_down_wait; move_right_stop(8); pen_up_wait; // 筆 - 下の部分6 move_leftup(4); move_up_stop(1); pen_down_wait; move_down(6); pen_up; move_down_stop(8); Off(OUT_A+OUT_B+OUT_C); }