課題1 似顔絵を書くロボット †ロボット本体 †プログラム †#define Go OnFwd(OUT_A+OUT_C); //前進する #define Stop Off(OUT_A+OUT_C); //止まる #define Down OnFwd(OUT_B);Wait(40);Off(OUT_B); //ペンを上げる #define Up OnRev(OUT_B);Wait(30);Off(OUT_B); //ペンを下げる #define BACK OnRev(OUT_A+OUT_C); //後進する #define Left OnFwd(OUT_C);OnRev(OUT_A);Wait(170); //反時計方向に回る #define Right OnFwd(OUT_A);OnRev(OUT_C);Wait(150); //時計方向に回る #define Keep Off(OUT_B); //ペン固定 task main() { Down; //鼻と左目を書く Go; Wait(80); Stop; Up; Wait(50); Stop; Up; Wait(50); Keep; Right; Go; Wait(30); Down; Wait(100); Go; Wait(160); Stop; Up; Wait(80); Left; Go; Wait(30); Down; Wait(100); Go; Wait(80); Stop; Up; Wait(50); Keep; Left; Go; Wait(30); Down; Wait(100); Go; //輪郭を書く Wait(220); Stop; Up; Wait(50); Keep; Left; Go; Wait(30); Down; Wait(100); Go; Wait(200); Stop; Up; Wait(50); Keep; Left; Go; Wait(30); Down; Wait(80); Go; Wait(220); Stop; Up; Wait(50); Keep; Left; Go; Wait(30); Down; Wait(100); Go; //右目と口を書く Wait(80); Stop; Up; Wait(50); Keep; Left; Go; Wait(30); Go; Wait(180); Stop; Up; Wait(50); Keep; Right; Go; Wait(30); Down; Wait(100); Go; Wait(80); Stop; Up; Wait(80); Keep; } //おわり、 感想 †プログラムが難しくあまりうまくいかなかった。 次からはもっと難しくなると思うので無理かもしれない。 |