[[2019a/Member]] Ìܼ¡ #contents *²ÝÂꣳ¤Î³µÍ× [#x60ce276] **²ÝÂê [#k9b9a0d1] ¥Ü¡¼¥ë±¿ÈÂ¥í¥Ü¥Ã¥È ³Æ¾ì½ê¤ËÇÛÃÖ¤µ¤ì¤Æ¤¤¤ë£´¤Ä¤Î¥Ü¡¼¥ë¤ò±¿È¤·¥È¥ì¡¼¤ÎÃæ¤ËÆþ¤ì¤ë¡Ê²¼¿Þ¤Ï¥Õ¥£¡¼¥ë¥É¥Þ¥Ã¥×¡Ë¡¥ &ref(2019a/Member/Kasai/Mission3/map3.png); **¥Õ¥£¡¼¥ë¥É¤ÎÀâÌÀ [#n4781383] -¥Õ¥£¡¼¥ë¥É¤Ï²ÝÂê2¤Ç»ÈÍѤ·¤¿»æ¤ò»ÈÍѤ¹¤ë¡£ -À¸¶¨¤Î¤ªÊÛÅö¤Î»Í³Ñ¤¤¥×¥éÍÆ´ï2¤Ä¤ò¤½¤ì¤¾¤ì±ßÆâ¤ËÃÖ¤¡¢ÊÒÊý¤Ë¶Ì¤ò2¸ÄÆþ¤ì¤ë¡£ -»Ä¤ê¤Î2¸Ä¤Î¶Ì¤Ï²ÝÂê2¤ÈƱ¤¸°ÌÃÖ¤ËÃÖ¤¯¡£¤½¤ÎºÝ¡¢¥´¥à¥¿¥¤¥ä¤ä¥×¥ì¡¼¥È¤Î¾å¤ËÃÖ¤¤¤Æ¤â¤è¤¤¡£ -¥×¥éÍÆ´ï¤Ë¤Ï¿§¤ò¤Ä¤±¤¿¤êʸ»ú¤äµ¹æ¤ò½ñ¤¤¤Æ¤â¤è¤¤¡£ -¥×¥éÍÆ´ï¤ÏξÌ̥ơ¼¥×Åù¤Ç¥Õ¥£¡¼¥ë¥É¤Ë¸ÇÄꤷ¤Æ¤â¤è¤¤¡£ -Ëç¤Î»æ¤Î¶³¦¤Ë¤Ï¤½¤ì¤¾¤ìÉý1cm¡¢¹ç·×2cm¤Î¹õÀþ¤òÉÁ¤¤¤Æ¤â¤è¤¤¡£ **´ðËܥ롼¥ë [#o4d86912] -¶¥µ»»þ´Ö¤Ï¿³È½¤¬Â³¹ÔÉÔǽ¤ÈȽÃǤ¹¤ë¤Þ¤Ç¡¢¤¢¤ë¤¤¤Ï¥ê¥¿¥¤¥¢¤¹¤ë¤Þ¤Ç¡£ -¿Þ¤ÎAÃÏÅÀ¤Þ¤¿¤Ï¡Ê¤ª¤è¤Ó¡ËA'ÃÏÅÀ¤«¤é¥¹¥¿¡¼¥È¤¹¤ë¡£¤¿¤À¤·ÀÜÃϤ·¤Æ¤¤¤ëÉôʬ¤Ï¤½¤ì¤¾¤ì¤ÎÎΰèÆâ¤Ë¼ý¤Þ¤ë¤â¤Î¤È¤¹¤ë¡ÊÀþ¾å¤ÏOK¡Ë¡£¾å¶õÉôʬ¤ÏÎΰ褫¤é¤Ï¤ß½Ð¤·¤Æ¤¤¤Æ¤â¤è¤¤¡£ -³«»Ï¤Î¹ç¿Þ¤«¤é£µÉÃ°ÊÆâ¤Ë¥¹¥¿¡¼¥È¥Ü¥¿¥ó¤ò²¡¤¹ºî¶È¤ò´°Î»¤¹¤ë¤³¤È¡£ -¶¥µ»¤¬½ªÎ»¤¹¤ë¤Þ¤Ç¡¢¥í¥Ü¥Ã¥È¤Ë¿¨¤Ã¤¿¤ê¿Í´Ö¤¬±ó³Ö¤ÇÁàºî¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ -ÅÓÃæ¤Ç¤¦¤Þ¤¯Æ°¤«¤Ê¤¯¤Ê¤Ã¤¿¾ì¹ç¡¢£±²ó¸Â¤êºÆ¥¹¥¿¡¼¥È¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡ÊºÆ¥¹¥¿¡¼¥È¤ÎºÝ¤ËÊÌ¥×¥í¥°¥é¥à¤Çµ¯Æ°¤·¤Æ¤è¤¤¡Ë¡£ -¶¥µ»½ªÎ»¸å¡¢¥í¥Ü¥Ã¥È¤¬¡¢¥´¡¼¥ë¤Î¥×¥éÍÆ´ï¤Ë¿¨¤ì¤Æ¤¤¤Æ¤Ï¤¤¤±¤Ê¤¤¡£ -¶¥µ»½ªÎ»¸å¡¢¤â¤È¤â¤È¶Ì¤¬Æþ¤Ã¤Æ¤¤¤¿¥×¥éÍÆ´ï¤¬¡¢¥´¡¼¥ë¤Î¥×¥éÍÆ´ï¤Ë¿¨¤ì¤Æ¤¤¤Æ¤Ï¤¤¤±¤Ê¤¤¡£ **´ðËÜÆÀÅÀ¤Î·×»»ÊýË¡ [#o929603d] -¥×¥éÍÆ´ïÆâ¤Î¶Ì¤ò1¸Ä±¿¤Ù¤Ð8ÅÀ¡£Æó¤Ä¤È¤â±¿¤Ù¤Ð20ÅÀ¡£ -LÃÏÅÀ¤ÈL'ÃÏÅÀ¤Î¶Ì¤ò¤É¤Á¤é¤«1¸Ä±¿¤Ù¤Ð4ÅÀ¡¢2¸Ä¤È¤â±¿¤Ù¤Ð12ÅÀ¡£ -¶¥µ»½ªÎ»¸å¡¢¥´¡¼¥ë¤Î¥×¥éÍÆ´ï¤¬´°Á´¤Ë±ß¤«¤é½Ð¤·¤Þ¤Ã¤¿¾ì¹ç¡¢¤â¤È¤Î´ðËÜÅÀ¤Î1/4¤ò¸ºÅÀ¡£ -¶¥µ»½ªÎ»¸å¡¢¥´¡¼¥ë¤Î¥×¥éÍÆ´ï¤ÎȾʬ°Ê¾å¤¬±ß¤«¤é½Ð¤Æ¤¤¤ì¤Ð¡¢¤â¤È¤Î´ðËÜÅÀ¤Î3/4¤ò¸ºÅÀ¡£ -¶¥µ»½ªÎ»¸å¡¢¥´¡¼¥ë¤Î¥×¥éÍÆ´ï¤Ë¤â¤È¤Î¥×¥éÍÆ´ï¤¬¿¨¤ì¤Æ¤¤¤ì¤Ð¡¢¤â¤È¤Î´ðËÜÅÀ¤Î1/2¤ò¸ºÅÀ¡£ -¶¥µ»½ªÎ»¸å¡¢¥´¡¼¥ë¤Î¥×¥éÍÆ´ï¤Ë¤â¤È¤Î¥×¥éÍÆ´ï¤¬¿¨¤ì¤Æ¤¤¤ì¤Ð¡¢¤â¤È¤Î´ðËÜÅÀ¤Î1/2¤ò¸ºÅÀ¡£ -¶¥µ»½ªÎ»¸å¡¢¥´¡¼¥ë¤Î¥×¥éÍÆ´ï¤Ë¥í¥Ü¥Ã¥È¤¬¿¨¤ì¤Æ¤¤¤ì¤Ð¡¢¤â¤È¤Î´ðËÜÅÀ¤Î1/4¤ò¸ºÅÀ¡£ *¥í¥Ü¥Ã¥È¤Ë¤Ä¤¤¤Æ [#yb212537] »ä¤¿¤Á¤ÎÈɤϡ¤¥Ü¡¼¥ë¤ò°ì¤Ä¤º¤Ä±¿¤Ö¥¿¥¤¥×¤Î¥í¥Ü¥Ã¥È¤òÀ©ºî¤·¤¿¡¥¤Þ¤¿¡¤º£²ó¤Î¥í¥Ü¥Ã¥È¤Ï¤Ç¤¤ë¤À¤±¥³¥ó¥Ñ¥¯¥È¤«¤Ä¥·¥ó¥×¥ë¤ò°Õ¼±¤·¤Æºî¤Ã¤¿¡¥¤Ê¤¼¤Ê¤éÁ°²óƱÍ;®²ó¤ê¤ÎɬÍפʥޥåפǤ¢¤ë¤¿¤á¤À¡¥Á´ÂÎÁü¤Ï¼¡¤Î¤è¤¦¤Ë¤Ê¤Ã¤¿¡¥ &ref(2019a/Member/Kasai/Mission3/zenntai_zou.jpg,50%); &ref(2019a/Member/Kasai/Mission3/zenntai_mae.jpg,50%); &ref(2019a/Member/Kasai/Mission3/zenntai_yoko.jpg,50%); **ËÜÂÎÉôʬ [#f585eaed] ¤Ç¤¤ë¤À¤±¾®¤µ¤¯¥³¥ó¥Ñ¥¯¥È¤Ë¤Ê¤ë¤è¤¦¤Ëºî¤Ã¤¿¡¥ËÜÂΤòÇØÌ̹ç¤ï¤»¤Ë¤·¡¤²ÝÂê2¤ÈƱ¤¸Â²ó¤ê¤È¹ç¤ï¤»¤¿¡¥¥»¥ó¥µ¡¼¤Ï¥×¥í¥°¥é¥ß¥ó¥°ºîÀ®¤Î»þ´Öû½Ì¤Î¤¿¤á°ì¤Ä¤À¤±»ÈÍѤ·²ÝÂê2¤Î¥×¥í¥°¥é¥à¤òºÆÍøÍѤ·¤¿¡¥°ÌÃ֤ϤǤ¤ë¤À¤±¼Ö¼´¤Ë¶á¤Å¤±¡¤¾®²ó¤ê¤¬Íø¤¯¤è¤¦¤Ë¤·¤¿¡¥ &ref(2019a/Member/Kasai/Mission3/asimawari.jpg,20%);&ref(2019a/Member/Kasai/Mission3/honntai.png,50%); **¥¢¡¼¥à¤È¤½¤Î¼þÊÕ [#eb33daab] ¥¢¡¼¥à¤âƱÍͤ˥·¥ó¥×¥ë¤ËÀ©ºî¤·¤¿¡¥¥â¡¼¥¿¡¼¤ËľÀÜÉôÉʤò¤Ä¤Ê¤²¤Æ²óž±¿Æ°¤òÍøÍѤ·¤Æ¥Ü¡¼¥ë¤ò¤Ä¤«¤à¡¥ &ref(2019a/Member/Kasai/Mission3/arm1.png,50%);&ref(2019a/Member/Kasai/Mission3/arm2.png,50%); °ø¤ß¤Ë¡¤¥¢¡¼¥à¤¬½Å¤¹¤®¤Æ¤½¤Î¤Þ¤Þ¤Ç¤Ï¾å¤²²¼¤²¤Ç¤¤Ê¤«¤Ã¤¿¤¿¤á¡¤ÎØ¥´¥à¤ò¤Ä¤±¤ÆÆ°¤¤òÊä½õ¤¹¤ë¤³¤È¤Çưºî¤ò²Äǽ¤Ë¤·¤¿¡¥ &ref(2019a/Member/Kasai/Mission3/sadou_hojo.jpg,60%); *ºîÀï [#sc81602d] **¥ë¡¼¥È¤Ë¤Ä¤¤¤Æ [#jec3f046] »ä¤¿¤Á¤ÎÈɤϰì¤Ä¤º¤Ä¥Ü¡¼¥ë¤ò±¿¤Ö¥í¥Ü¥Ã¥È¤òºî¤Ã¤¿¤¿¤á¡¤¹ç·×4²ó¥È¥ì¡¼¤Ë¹Ô¤«¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡¥¤½¤Î¤¿¤á¡¤¼¡¤Î¤è¤¦¤Ê¥ë¡¼¥È¤ò¹Í°Æ¤·¤¿¡¥ &ref(2019a/Member/Kasai/Mission3/sakusenn_route.jpg,100%); ¡A'¤ò½Ðȯ¤·L'¤Î¥Ü¡¼¥ë¤òÄϤߡ¤Àû²ó¤·¤ÆÍÆ´ï¤ËÆþ¤ì¤ë¡¥ &ref(2019a/Member/Kasai/Mission3/route1.png,50%); ¢¼¡¤Ë¡¤¤½¤³¤«¤éľÀþ¤òÆÍ¤ÃÀڤäÆÍÆ´ï¤ÎÃæ¤Î¥Ô¥ó¥Ý¥ó¶Ì¤òÄϤߥ´¡¼¥ë¤Ë¤¢¤ëÍÆ´ï¤ËÆþ¤ìÂØ¤¨¤ë¡¥ &ref(2019a/Member/Kasai/Mission3/route2.png,50%); £Æ±¤¸¤¯ÍÆ´ï¤ÎÃæ¤Î¥Ü¡¼¥ë¤ò¥´¡¼¥ë¤ÎÍÆ´ï¤Ë»ý¤Ã¤Æ¤¤¤Æþ¤ì¤ë¡¥ &ref(2019a/Member/Kasai/Mission3/route3.png,50%); ¤ºÇ¸å¤Ë¡¤L¤Ë¤¢¤ë¥Ü¡¼¥ë¤òÄϤߥ´¡¼¥ë¤ÎÍÆ´ï¤ËÆþ¤ì¤ë¡¥ &ref(2019a/Member/Kasai/Mission3/route4.png,50%); *¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤Æ [#y8027e38] ¤Þ¤º¡¤ -¥Þ¥¹¥¿¡¼¡§º¸¼ÖÎØ¡¤±¦¼ÖÎØ¡¤¥¢¡¼¥à¤Î¾å¤²²¼¤² -¥¹¥ì¡¼¥ô¡§¥Ü¡¼¥ë¤òÄÏ¤àÆ°ºî ¤ÇÀ©¸æ¤·¤Æ¤¤¤ë¡¥ **¶¦Ä̤¹¤ë¥×¥í¥°¥é¥à [#q89589b4] 2Âæ¤ÎNXC¤ÇÄÌ¿®¤ò¹Ô¤¦¤¿¤á¤Ë¡¢°Ê²¼¤Î¤è¤¦¤Ë¥Þ¥¯¥í¤òÄêµÁ¤ò¤·¤¿¡£ #define SIGNALON1 11 #define SIGNALOFF1 12 #define SIGNALON2 13 #define SIGNALOFF2 14 **¥¢¡¼¥à¤Î¥×¥í¥°¥é¥à [#ca683c72] ***¥¢¡¼¥à¤Î¾å¤²²¼¤²¤Î¥Þ¥¯¥í [#h1926a7c] #define arm_down OnFwd(OUT_A,25);Wait(1500);Off(OUT_A); //¥¢¡¼¥à¤ò²¼¤²¤ë #define arm_up OnRev(OUT_A,35);Wait(1500);Off(OUT_A); //¥¢¡¼¥à¤ò¾å¤²¤ë ***¥¹¥ì¡¼¥ô¦¤ÎÀ©¸æ [#m1d36065] #define SIGNALON1 11 #define SIGNALOFF1 12 #define SIGNALON2 13 #define SIGNALOFF2 14 #define CONN 1 task main() { int msg; while(true){ ReceiveRemoteNumber(MAILBOX1,true,msg); if(msg==SIGNALON1){¡¡¡¡¡¡¡¡¡¡¡¡¡¡//SIGNALON1¤ò¼õ¿®¤·¤¿¤È¤ OnRev(OUT_A,20);Wait(1000);¡¡//¥Ü¡¼¥ë¤òÄϤà }else if(msg==SIGNALOFF1){¡¡¡¡¡¡ //SIGNALOFF1¤ò¼õ¿®¤·¤¿¤È¤ Off(OUT_A);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¥â¡¼¥¿A¤ò»ß¤á¤ë }else if(msg==SIGNALON2){¡¡¡¡¡¡¡¡//SIGNALON2¤ò¼õ¿®¤·¤¿¤È¤ OnFwd(OUT_A,20);Wait(1000);¡¡//¥Ü¡¼¥ë¤òÊü¤¹ }else if(msg==SIGNALOFF2){¡¡¡¡¡¡ //SIGNALOFF2¤ò¼õ¿®¤·¤¿¤È¤ Off(OUT_A);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¥â¡¼¥¿A¤ò»ß¤á¤ë } } } **¥é¥¤¥ó¥È¥ì¡¼¥¹ [#v6dd6f42] ¸÷¥»¥ó¥µ¡¼¤Î¿ôÃͤϰʲ¼¤ÎÄ̤ê¥Þ¥¯¥í¤ÇÄêµÁ¤·¤¿¡¥ #define black 30 #define white 60 #define lightgray 50 #define darkgray 39 #define center 45 &ref(2019a/Member/Kasai/Mission3/light_sennser.png,40%); ¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¥×¥í¥°¥é¥à¤Ï²ÝÂꣲ¤Î»þ¤È¤Û¤È¤ó¤ÉƱ¤¸¤â¤Î¤ò»ÈÍѤ·¤¿¡¥ ***¥Þ¥¯¥í [#g6c5fae1] ´ðËÜŪ¤Êưºî¡¤¥á¥Ã¥»¡¼¥¸¤ÎÃͤòÄêµÁ¤¹¤ë¡¥ #define CONN 1 #define SIGNALON1 11 #define SIGNALOFF1 12 #define SIGNALON2 13 #define SIGNALOFF2 14 #define turn_right OnFwd(OUT_C,25);OnRev(OUT_B,23); //±¦ÀÞ #define turn_left OnFwd(OUT_B,28);OnRev(OUT_C,20); //º¸ÀÞ #define rotate_right OnFwd(OUT_C,25);OnRev(OUT_B,22); //±¦Àû²ó #define rotate_left OnFwd(OUT_B,28);OnRev(OUT_C,15); //º¸Àû²ó #define go_straight OnFwd(OUT_B,23);OnFwd(OUT_C,20); //ľ¿Ê #define go_straight2 OnFwd(OUT_B,20);OnFwd(OUT_C,17); //K'¤«¤éL'¤Ç¤Î½ÐÎϼå¤á¤Îľ¿Ê #define turn OnRev(OUT_C,20);OnFwd(OUT_B,28);Wait(3200);Off(OUT_BC); //L'¤Î¥Ü¡¼¥ëÄϤó¤Ç¤«¤éÆþ¤ì¤ë¤Þ¤Ç¤ÎÀû²ó #define turn2 OnRev(OUT_B,28);OnFwd(OUT_C,20);Wait(1500);Off(OUT_BC); //¥Ü¡¼¥ë¤ÎÆþ¤Ã¤Æ¤ë¥È¥ì¡¼¤Ø¤Î¤ï¤º¤«¤ÊÄ´À° #define sakittyo OnFwd(OUT_C,20);OnFwd(OUT_B,23);Wait(1150);Off(OUT_BC); //¥Ü¡¼¥ë¤¬Æþ¤Ã¤Æ¤ë¥È¥ì¡¼Á°¤Ç¤Î¤ï¤º¤«¤ÊÁ°¿Ê #define turn3 OnRev(OUT_B,30);Wait(4800);Off(OUT_BC); //¥È¥ì¡¼¤Î¥Ü¡¼¥ë¤òÄϤó¤À¸å¤ÎÊý¸þž´¹ #define turn4 OnRev(OUT_B,30);Wait(5200);Off(OUT_BC); // #define back OnRev(OUT_C,20);OnRev(OUT_B,28);Wait(3000);Off(OUT_BC); //ºÇ¸å¥È¥ì¡¼¤Ë¿¨¤ì¤Ê¤¤¤è¤¦¤Ë¾¯¤·Î¥¤ì¤ë **¥µ¥Ö¥ë¡¼¥Á¥ó [#x778946d] ***º¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ [#l1d9eb72] sub followline_L(int stop_time) { long t0=CurrentTick(); while(CurrentTick()-t0<stop_time){ //¸½ºß¤Î»þ¹ï¤¬°ìÄê¤ÎÃͤòͤ¨¤ë¤Þ¤Ç if(SENSOR_1<black){ //¥»¥ó¥µ¡¼¤¬¹õ¤Î»þ rotate_left; //º¸Àû²ó }else if(SENSOR_1<darkgray){ //¥»¥ó¥µ¡¼¤¬¹õ³¥¤Ê¤é turn_left; //º¸ÀÞ }else if(SENSOR_1>lightgray){ //¥»¥ó¥µ¡¼¤¬Çò³¥¤Ê¤é turn_right; //±¦ÀÞ t0=CurrentTick(); //»þ´Ö¤ò¥ê¥»¥Ã¥È }else if(SENSOR_1<center){ //ÌÀ¤ë¤µ45°Ê²¼¤Ç go_straight; //ľ¿Ê t0=CurrentTick(); //»þ´Ö¤ò¥ê¥»¥Ã¥È }else{ //¤½¤ì°Ê³°¤Ï rotate_right; //±¦Àû²ó t0=CurrentTick(); //»þ´Ö¤ò¥ê¥»¥Ã¥È } } Off(OUT_BC); //»þ¹ï¤¬°ìÄê¤ÎÃͤòͤ¨¤ë¤ÈÄä»ß Wait(1000); //1ÉôÖÄä»ß } ***±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ [#a40d4d55] sub followline_R(int stop_time) { long t0=CurrentTick(); while(CurrentTick()-t0<stop_time){ //¸½ºß¤Î»þ¹ï¤¬°ìÄê¤ÎÃͤòͤ¨¤ë¤Þ¤Ç if(SENSOR_1<black){ //¥»¥ó¥µ¡¼¤¬¹õ¤Î»þ rotate_right; //±¦Àû²ó }else if(SENSOR_1<darkgray){ //¥»¥ó¥µ¡¼¤¬¹õ³¥¤Ê¤é turn_right; //±¦ÀÞ }else if(SENSOR_1>lightgray){ //¥»¥ó¥µ¡¼¤¬Çò³¥¤Ê¤é turn_left; //º¸ÀÞ t0=CurrentTick(); //»þ´Ö¤ò¥ê¥»¥Ã¥È }else if(SENSOR_1<center){ //¥»¥ó¥µ¡¼¤¬45°Ê²¼¤Ê¤é go_straight; //ľ¿Ê t0=CurrentTick(); //»þ´Ö¤ò¥ê¥»¥Ã¥È }else{ //¤½¤ì°Ê³°¤Ï rotate_left; //º¸Àû²ó t0=CurrentTick(); //»þ´Ö¤ò¥ê¥»¥Ã¥È } } Off(OUT_BC); //°ìÄê¤Î»þ´Ö¤òͤ¨¤ë¤ÈÄä»ß Wait(1000); //°ìÉôÖÄä»ß } ***±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹(ľ¿Ê¤Î½ÐÎϤ¬¼å¤¤¥Ñ¥¿¡¼¥ó) [#abb2baa3] sub followline_R2(int stop_time) { long t0=CurrentTick(); while(CurrentTick()-t0<stop_time){ //»þ¹ï¤¬¤¢¤ë°ìÄê¤ÎÃͤè¤ê¾®¤µ¤¤¤È¤ if(SENSOR_1<black){ //¹õ¤Ê¤é rotate_right; //±¦Àû²ó t0=CurrentTick(); //»þ´Ö¤ò¥ê¥»¥Ã¥È }else if(SENSOR_1<darkgray){ //³¥¹õ¿§¤Ê¤é turn_right; //±¦ÀÞ t0=CurrentTick(); //»þ´Ö¤ò¥ê¥»¥Ã¥È }else if(SENSOR_1>lightgray){ //³¥Çò¿§¤Ê¤é turn_left; //º¸ÀÞ }else if(SENSOR_1<center){ //ÌÀ¤ë¤µ45°Ê²¼¤Ç go_straight2; //¤æ¤Ã¤¯¤êľ¿Ê t0=CurrentTick(); //»þ´Ö¤ò¥ê¥»¥Ã¥È }else{ //¤½¤ì°Ê³°¤Ê¤é rotate_left; //º¸Àû²ó } } Off(OUT_BC); //Ää»ß Wait(2000); //2ÉôÖÄä»ß } ***¹õÀþ¤ò²£ÃÇ [#g2397abe] -¹õ¤ò¸«¤Ä¤±¤ë¤Þ¤Çľ¿Ê sub Blackto_White() { while(SENSOR_1<lightgray){¡¡//¸÷¥»¥ó¥µ¡¼¤ÎÃͤ¬Çò³¥¤è¤ê¾®¤µ¤¤¤È¤ OnFwd(OUT_C,25);¡¡¡¡¡¡¡¡¡¡¡¡ OnFwd(OUT_B,25);¡¡¡¡¡¡¡¡¡¡¡¡//ľ¿Ê } Off(OUT_BC);¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//Çò³¥¤è¤êÂ礤¯¤Ê¤ë¤È»ß¤Þ¤ë } -Çò¤ò¸«¤Ä¤±¤ë¤Þ¤Çľ¿Ê sub Whiteto_Black() { while(SENSOR_1>darkgray){¡¡//¸÷¥»¥ó¥µ¡¼¤ÎÃͤ¬¹õ³¥¤è¤ê¤âÂ礤¤¤È¤ OnFwd(OUT_C,25);¡¡¡¡¡¡¡¡¡¡ OnFwd(OUT_B,25); //ľ¿Ê } Off(OUT_BC); //¹õ³¥¤è¤ê¤âÂ礤¯¤Ê¤ë¤È»ß¤Þ¤ë } ¤³¤Î£²¤Ä¤òÁȤ߹ç¤ï¤»¤ë¤³¤È¤Ç¹õÀþ¤ò°ìËÜÄ̤ê±Û¤»¤ë¡¥ ***¤½¤Î¾ [#b4e1022d] ¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î±¦Â¦¤Èº¸Â¦¤òÆþ¤ìÂØ¤¨¤ë¤È¤¤Ê¤É¤Ë»È¤¦¡¥ -¹õ¤ò¸«¤Ä¤±¤ë¤Þ¤Ç±¦Àû²ó sub Whiteto_Black_R() { while(SENSOR_1>darkgray){¡¡//¸÷¥»¥ó¥µ¡¼¤ÎÃͤ¬¹õ³¥¤è¤ê¤âÂ礤¤¤È¤ OnFwd(OUT_C,25);¡¡¡¡¡¡¡¡¡¡ OnRev(OUT_B,25); //±¦Àû²ó } Off(OUT_BC); //¹õ³¥¤è¤ê¤â¾®¤µ¤¯¤Ê¤ë¤È»ß¤Þ¤ë } -Çò¤ò¸«¤Ä¤±¤ë¤Þ¤Ç±¦Àû²ó sub Blackto_White_R() { while(SENSOR_1<darkgray){¡¡//¸÷¥»¥ó¥µ¡¼¤ÎÃͤ¬¹õ³¥¤è¤ê¤â¾®¤µ¤¤¤È¤ OnFwd(OUT_C,25); OnRev(OUT_B,25); //±¦Àû²ó } Off(OUT_BC); //¹õ³¥¤è¤ê¤âÂ礤¯¤Ê¤ë¤È»ß¤Þ¤ë } -Çò¤ò¸«¤Ä¤±¤ë¤Þ¤Çº¸Àû²ó sub Blackto_White_L() { while(SENSOR_1<lightgray){¡¡//¸÷¥»¥ó¥µ¡¼¤ÎÃͤ¬Çò³¥¤è¤ê¾®¤µ¤¤¤È¤ OnFwd(OUT_B,25); OnRev(OUT_C,25); //º¸Àû²ó } Off(OUT_BC); //Çò³¥¤è¤êÂ礤¯¤Ê¤ë¤È»ß¤Þ¤ë } -¹õ¤ò¸«¤Ä¤±¤ë¤Þ¤Çº¸Àû²ó sub Whiteto_Black_L() { while(SENSOR_1>black){¡¡//¸÷¥»¥ó¥µ¡¼¤ÎÃͤ¬¹õ¤è¤êÂ礤¤¤È¤ OnFwd(OUT_B,25); OnRev(OUT_C,25); //º¸Àû²ó } Off(OUT_BC); //¹õ¤è¤ê¾®¤µ¤¤¤È¤ } **¥Þ¥¹¥¿¡¼¤Î¥×¥í¥°¥é¥à [#h247f23a] task main() { SetSensorLight(S1); RemoteStartProgram(CONN,"kodomo.nxc"); followline_R(200); Blackto_White(); followline_L(150); Blackto_White_R(); followline_R2(150); SendRemoteNumber(CONN,MAILBOX1,SIGNALON1); Wait(1000); arm_up; turn; SendRemoteNumber(CONN,MAILBOX1,SIGNALON2); Wait(1000); followline_R(150); Blackto_White_L(); followline_L(100); Blackto_White(); Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); followline_R(150); Blackto_White(); turn2; sakittyo; arm_down; SendRemoteNumber(CONN,MAILBOX1,SIGNALON1); Wait(1000); arm_up; turn3; Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); followline_R(200); Blackto_White(); turn2; SendRemoteNumber(CONN,MAILBOX1,SIGNALON2); Wait(1000); turn3; Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); followline_R(200); Blackto_White(); turn2; sakittyo; arm_down; SendRemoteNumber(CONN,MAILBOX1,SIGNALON1); Wait(1000); arm_up; turn3; Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); Blackto_White_R(); followline_R(200); Blackto_White(); turn2; SendRemoteNumber(CONN,MAILBOX1,SIGNALON2); Wait(1500); turn4; arm_down Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); followline_L(200); Blackto_White(); followline_R(200); Blackto_White(); followline_L(200); Blackto_White(); followline_R(200); Blackto_White(); followline_L(150); Blackto_White_R(); followline_R2(125); SendRemoteNumber(CONN,MAILBOX1,SIGNALON1); Wait(1000); arm_up; turn; followline_R(100); Blackto_White_L(); followline_L(100); Blackto_White(); Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); followline_R(200); Blackto_White(); turn2; sakittyo; SendRemoteNumber(CONN,MAILBOX1,SIGNALON2); Wait(1000); } ¥´¡¼¥ë¤Î¥È¥ì¡¼¤òGT¡¤¤â¤È¤â¤È¥Ü¡¼¥ë¤òÆþ¤ì¤Æ¤¢¤ë¥È¥ì¡¼¤òST¤È¸Æ¤Ö¤È¡¤ °ì¤ÄÌܤβô¤Ï¡¤M'¤«¤é¥¹¥¿¡¼¥È¤·L'¤Î¥Ü¡¼¥ë¤òÄϤó¤ÇGT¤ËÆþ¤ì¤ë¤Þ¤Ç¤Î¥×¥í¥°¥é¥à Æó¤ÄÌܤβô¤Ï¡¤L'¤Î¥Ü¡¼¥ë¤òÆþ¤ì¤¿¸åST¤Þ¤Ç¹Ô¤¡¤¥Ü¡¼¥ë¤òÄϤà¤Þ¤Ç¤Î¥×¥í¥°¥é¥à »°¤ÄÌܤβô¤Ï¡¤ST¤«¤éGT¤Þ¤Ç¹Ô¤¡¤¥Ü¡¼¥ë¤òÆþ¤ì¤ë¥×¥í¥°¥é¥à »Í¤ÄÌܤβô¤Ï¡¤¥Ü¡¼¥ë¤òÆþ¤ì¤Æ¤«¤é¤Þ¤¿ST¤Þ¤Ç¹Ô¤¡¤¥Ü¡¼¥ë¤òÄϤà¤Þ¤Ç¤Î¥×¥í¥°¥é¥à ¸Þ¤ÄÌܤβô¤Ï¡¤¥Ü¡¼¥ë¤òÄϤó¤Ç¤«¤éGT¤Þ¤Ç¹Ô¤¥´¡¼¥ë¤¹¤ë¤Þ¤Ç¤Î¥×¥í¥°¥é¥à Ï»¤ÄÌܤβô¤Ï¡¤ST¤«¤éL¤Þ¤Ç°Üư¤·¡¤L¤Î¥Ü¡¼¥ë¤òÄϤà¤Þ¤Ç¤Î¥×¥í¥°¥é¥à ¼·¤ÄÌܤβô¤Ï¡¤L¤«¤éGT¤Þ¤Ç°Üư¤·¤Æ¥´¡¼¥ë¤·¡¤¥È¥ì¡¼¤«¤é¾¯¤·Î¥¤ì¤Þ¤Ç¤Î¥×¥í¥°¥é¥à ¤Ç¤¢¤ë¡¥ *´°À®¤·¤¿¥×¥í¥°¥é¥à [#zf89ae7a] #define CONN 1 #define SIGNALON1 11 #define SIGNALOFF1 12 #define SIGNALON2 13 #define SIGNALOFF2 14 #define turn_right OnFwd(OUT_C,25);OnRev(OUT_B,23); #define turn_left OnFwd(OUT_B,28);OnRev(OUT_C,20); #define rotate_right OnFwd(OUT_C,25);OnRev(OUT_B,22); #define rotate_left OnFwd(OUT_B,28);OnRev(OUT_C,15); #define go_straight OnFwd(OUT_B,23);OnFwd(OUT_C,20); #define go_straight2 OnFwd(OUT_B,20);OnFwd(OUT_C,17); #define turn OnRev(OUT_C,20);OnFwd(OUT_B,28);Wait(3200);Off(OUT_BC); #define turn2 OnRev(OUT_B,28);OnFwd(OUT_C,20);Wait(1500);Off(OUT_BC); #define sakittyo OnFwd(OUT_C,20);OnFwd(OUT_B,23);Wait(1150);Off(OUT_BC); #define turn3 OnRev(OUT_B,30);Wait(4800);Off(OUT_BC); #define turn4 OnRev(OUT_B,30);Wait(5200);Off(OUT_BC); #define back OnRev(OUT_C,20);OnRev(OUT_B,28);Wait(3000);Off(OUT_BC); #define osidasi OnFwd(OUT_BC,100);Wait(100);Off(OUT_BC); #define arm_down OnFwd(OUT_A,25);Wait(1500);Off(OUT_A); #define arm_up OnRev(OUT_A,35);Wait(1500);Off(OUT_A); #define black 30 #define white 60 #define lightgray 50 #define darkgray 39 #define center 45 sub followline_L(int stop_time) { long t0=CurrentTick(); while(CurrentTick()-t0<stop_time){ if(SENSOR_1<black){ rotate_left; }else if(SENSOR_1<darkgray){ turn_left; }else if(SENSOR_1>lightgray){ turn_right; t0=CurrentTick(); }else if(SENSOR_1<center){ go_straight; t0=CurrentTick(); }else{ rotate_right; t0=CurrentTick(); } } Off(OUT_BC); Wait(1000); } sub followline_R(int stop_time) { long t0=CurrentTick(); while(CurrentTick()-t0<stop_time){ if(SENSOR_1<black){ rotate_right; }else if(SENSOR_1<darkgray){ turn_right; }else if(SENSOR_1>lightgray){ turn_left; t0=CurrentTick(); }else if(SENSOR_1<center){ go_straight; t0=CurrentTick(); }else{ rotate_left; t0=CurrentTick(); } } Off(OUT_BC); Wait(1000); } sub followline_R2(int stop_time) { long t0=CurrentTick(); while(CurrentTick()-t0<stop_time){ if(SENSOR_1<black){ rotate_right; t0=CurrentTick(); }else if(SENSOR_1<darkgray){ turn_right; t0=CurrentTick(); }else if(SENSOR_1>lightgray){ turn_left; }else if(SENSOR_1<center){ go_straight2; t0=CurrentTick(); }else{ rotate_left; } } Off(OUT_BC); Wait(2000); } sub Blackto_White() { while(SENSOR_1<lightgray){ OnFwd(OUT_C,25); OnFwd(OUT_B,25); } Off(OUT_BC); } sub Whiteto_Black() { while(SENSOR_1>darkgray){ OnFwd(OUT_C,25); OnFwd(OUT_B,25); } Off(OUT_BC); } sub Whiteto_Black_R() { while(SENSOR_1>darkgray){ OnFwd(OUT_C,25); OnRev(OUT_B,25); } Off(OUT_BC); } sub Blackto_White_R() { while(SENSOR_1<darkgray){ OnFwd(OUT_C,25); OnRev(OUT_B,25); } Off(OUT_BC); } sub Blackto_White_L() { while(SENSOR_1<lightgray){ OnFwd(OUT_B,25); OnRev(OUT_C,25); } Off(OUT_BC); } sub Whiteto_Black_L() { while(SENSOR_1>black){ OnFwd(OUT_B,25); OnRev(OUT_C,25); } Off(OUT_BC); } task main() { SetSensorLight(S1); RemoteStartProgram(CONN,"kodomo.nxc"); followline_R(200); Blackto_White(); followline_L(150); Blackto_White_R(); followline_R2(150); SendRemoteNumber(CONN,MAILBOX1,SIGNALON1); Wait(1000); arm_up; turn; SendRemoteNumber(CONN,MAILBOX1,SIGNALON2); Wait(1000); followline_R(150); Blackto_White_L(); followline_L(100); Blackto_White(); Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); followline_R(150); Blackto_White(); turn2; sakittyo; arm_down; SendRemoteNumber(CONN,MAILBOX1,SIGNALON1); Wait(1000); arm_up; turn3; Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); followline_R(200); Blackto_White(); turn2; SendRemoteNumber(CONN,MAILBOX1,SIGNALON2); Wait(1000); turn3; Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); followline_R(200); Blackto_White(); turn2; sakittyo; arm_down; SendRemoteNumber(CONN,MAILBOX1,SIGNALON1); Wait(1000); arm_up; turn3; Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); Blackto_White_R(); followline_R(200); Blackto_White(); turn2; SendRemoteNumber(CONN,MAILBOX1,SIGNALON2); Wait(1500); turn4; arm_down Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); followline_L(200); Blackto_White(); followline_R(200); Blackto_White(); followline_L(200); Blackto_White(); followline_R(200); Blackto_White(); followline_L(150); Blackto_White_R(); followline_R2(125); SendRemoteNumber(CONN,MAILBOX1,SIGNALON1); Wait(1000); arm_up; turn; followline_R(100); Blackto_White_L(); followline_L(100); Blackto_White(); Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); Whiteto_Black(); Blackto_White(); followline_R(200); Blackto_White(); turn2; sakittyo; SendRemoteNumber(CONN,MAILBOX1,SIGNALON2); Wait(1000); } #define SIGNALON1 11 #define SIGNALOFF1 12 #define SIGNALON2 13 #define SIGNALOFF2 14 #define CONN 1 task main() { int msg; while(true){ ReceiveRemoteNumber(MAILBOX1,true,msg); if(msg==SIGNALON1){ OnRev(OUT_A,20);Wait(1000); }else if(msg==SIGNALOFF1){ Off(OUT_A); }else if(msg==SIGNALON2){ OnFwd(OUT_A,20);Wait(1000); }else if(msg==SIGNALOFF2){ Off(OUT_A); } } } *¤Þ¤È¤á¡¤´¶ÁÛ [#ndbddb0f] º£²ó¤Î²ÝÂê¤Ï¥×¥í¥°¥é¥ß¥ó¥°¤Ï¤â¤Á¤í¤ó¤Î¤³¤È¤À¤¬¡¤ÆÃ¤Ë¥í¥Ü¥Ã¥È¤ÎºîÀ®¤Ë¤«¤Ê¤ê»þ´Ö¤ò¼è¤é¤ì¤¿¡¥¥Ü¡¼¥ë¤ò»ý¤Á±¿¤Öµ¡Ç½¤ä¤¤¤«¤Ë¥³¥ó¥Ñ¥¯¥È¤Êµ¡ÂΤòºîÀ®¤¹¤ë¤«¤Ë¶ìÏ«¤µ¤»¤é¤ì¤¿¡¥ ¥×¥í¥°¥é¥ß¥ó¥°¤Ë´Ø¤·¤Æ¤Ï¡¤¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ï²ÝÂꣲ¤Î¥×¥í¥°¥é¥à¤ò¤½¤Î¤Þ¤Þ»È¤¨¤¿¤Î¤Ç¼ê´Ö¤Ï¾Ê¤±¤¿¤¬¡¤¤ä¤Ï¤ê¤½¤ì¤¾¤ì¤Î¥â¡¼¥¿¡¼¤Î½ÐÎϺ¹¤äÅÅÃÓÀÚ¤ì¤Ê¤É¤Î¸¶°ø¤Ë¼ê¤³¤º¤ë¤³¤È¤¬Â¿¤¯¡¤º¸±¦¤Ç¤Î¥¿¥¤¥ä¤Î½ÐÎϤÎÄ´À°¤äËÜÂΤθþ¤¤òÊѤ¨¤ë¤È¤¤ÎÉÿô¤Ê¤É¤Ë¿¤¯¤Î»þ´Ö¤òÈñ¤ä¤·¤¿¡¥ ¤·¤«¤·¡¤¥í¥Ü¥³¥ó¤Î·ë²Ì¤ò¸«¤ì¤Ð¡¤¥È¥ì¡¼¤Î¥Ü¡¼¥ë°ì¤Ä¤·¤«±¿¤Ù¤Æ¤Ê¤«¤Ã¤¿¤¬£²°Ì¤Ë¤Ê¤ë¤³¤È¤¬¤Ç¤¤¿¤Î¤Ç¡¤¤Ç¤¤Ï°¤¯¤Ê¤«¤Ã¤¿¤Î¤Ç¤Ï¤Ê¤¤¤«¤È»×¤¦¡¥