2019a/Member/Gouki/Mission2
¤ò¥Æ¥ó¥×¥ì¡¼¥È¤Ë¤·¤ÆºîÀ®
[
¥È¥Ã¥×
] [
¿·µ¬
|
°ìÍ÷
|
¸¡º÷
|
ºÇ½ª¹¹¿·
|
¥Ø¥ë¥×
|
¥í¥°¥¤¥ó
]
³«»Ï¹Ô:
Ìܼ¡
#contents
*²ÝÂê¤Ë¤Ä¤¤¤Æ [#xd5df109]
²¼¤Î¤è¤¦¤Ê¿Þ¤ò¥Á¡¼¥à¤´¤È¤ËºîÀ®¤·¡¢¹õ¤¤Àþ¤Î¾å¤òÁö¤ë¤è¤¦¤Ê¥í¥Ü¥Ã¥È¤òºîÀ®¤¹¤ë¡£
#ref(2019a/Member/Gouki/Mission2/2019a-mission2.png,70%);
**²ÝÂê¤Î¾ÜºÙ [#f419cc01]
AÃÏÅÀ¤ò½Ðȯ¤·¡¢¼¡¤Î·ÐÏ©¤ò¹õ¤¤Àþ¤Ë¤½¤Ã¤ÆÆ°¤¡¢ºÇ¸å¤Ë¥Ô¥ó¥Ý¥óµå¤ò¥´¡¼¥ë¤ËÆþ¤ì¤ë¥í¥Ü¥Ã¥È¤òºîÀ®¤¹¤ë
#ref(2019a/Member/Gouki/Mission2/Inked2019a-mission2_LI.jpg,70%);
¡AÃÏÅÀ¤«¤é½Ðȯ
¢B¤òľ¿Ê
£C¤òľ¿Ê
¤D¤ò°ì»þÄä»ß¤Î¸å¤Ëľ¿Ê
¥E¤òľ¿Ê
¦F¤òľ¿Ê
§G¤ò°ì»þÄä»ß¤Î¸å¤Ë±¦ÀÞ
¨H¤òľ¿Ê
©I¤òľ¿Ê
ªJ¤ò±¦ÀÞ
«K¤òº¸ÀÞ
¬L¤Ç¥Ô¥ó¥Ý¥ó¶Ì¤ò¤Ä¤«¤à
K¤òľ¿Ê
®M¤Ç°ì»þÄä»ß
¯¥·¥å¡¼¥È
°AÃÏÅÀ¤ËÆþ¤ë(¥´¡¼¥ë)
*¥í¥Ü¥Ã¥ÈËÜÂΤˤĤ¤¤Æ [#d3ddfb99]
**¥í¥Ü¥Ã¥ÈÁ´ÂÎ [#f2f596ad]
#ref(2019a/Member/Gouki/Mission2/line_175788711878042.jpg,30%);
º£²ó¤Îµ¡ÂΤòÀ©ºî¤¹¤ë¤Ë¤¢¤¿¤ê¡¢¿Þ¾å¤Ç¤¤Á¤ó¤È¾®²ó¤ê¤¬¤¤¯¤è¤¦¤Ë¡¢¤Ê¤ë¤Ù¤¯¾®¤µ¤¤¥í¥Ü¥Ã¥È¤Ë¤·¤¿¡£~
**¸÷¥»¥ó¥µ¡¼Éôʬ [#z7f7e944]
#ref(2019a/Member/Gouki/Mission2/line_175812470413242.jpg,30%);
¸÷¥»¥ó¥µ¡¼¤Î¾ì½ê¤Ï¡¢¶á¤¹¤®¤º±ó¤¹¤®¤º¤Ê¤ë¤Ù¤¯Àµ³Î¤ÊÃͤò¿Þ¤ì¤ë¤è¤¦¤Ë¤·¤¿¡£
**¥¿¥¤¥äÉôʬ [#o8ddbba8]
#ref(2019a/Member/Gouki/Mission2/line_175792940901791.jpg,30%);
¥¿¥¤¥ä¤Ï¤Ê¤ë¤Ù¤¯¸÷¥»¥ó¥µ¡¼¤Ë¶á¤¯¤Ê¤ë¤è¤¦¤ËÀ߷פ·¤¿¡£~
Íýͳ¤È¤·¤Æ¤Ï¡¢¸÷¤ò¸¡ÃΤ·¡¢¥¿¥¤¥ä¤ò¤¤¤ÁÁ᤯¸¡ÃΤ·¤¿¸÷¤ÎÃͤλþ¤Î¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤µ¤»¡¢Æ°ºî¤¹¤ë¾å¤Ç¤Î¸íº¹¤ò¤Ê¤¯¤¹¤¿¤á¤À¡£
**¤Ä¤«¤àµ¡¹½ [#q8a37cf4]
#ref(2019a/Member/Gouki/Mission2/line_175760293908939.jpg,30%);
#ref(2019a/Member/Gouki/Mission2/Inkedline_175750132339776_LI.jpg,30%);
¥¢¡¼¥à¤Î³«ÊĤι½Â¤¤Ï¿Þ¤ò¸«¤Æ¤â¤é¤Ã¤¿Êý¤¬Ê¬¤«¤ê¤ä¤¹¤¤¤¬¡¢~
¡¥â¡¼¥¿¡¼¤ò¸þ¤«¤Ã¤Æ¾å¤«¤é¾åÊý¸þ¤Ë²ó¤¹¤È¥¢¡¼¥à¤ò³«¤¯~
¢¥â¡¼¥¿¡¼¤ò¸þ¤«¤Ã¤Æ¾å¤«¤é²¼Êý¸þ¤Ë²ó¤¹¤È¥¢¡¼¥à¤¬ÊĤ¸¤ë~
*¸Ä¡¹¤Î¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤Æ [#x8c757c8]
**¥é¥¤¥ó¥È¥ì¡¼¥¹ [#ja65743e]
º£²ó¤Ï¡¢¹õ¤¤Àþ¤òÄɽ¾¤¹¤ë¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¥×¥í¥°¥é¥ß¥ó¥°¤òºî¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£~
¤Þ¤º¤Ï¸÷¤ÎÃͤò¬¤ë¡£»ä¤¿¤Á¤Ï¡Ö´°Á´¤Ë¿¿¤ÃÇò¡×¡¢¡ÖÇò¤È¶Ìܤδ֡ס¢¡Ö¶Ìܡס¢¡Ö¹õ¤È¶Ìܤδ֡ס¢~
¡Ö´°Á´¤Ë¹õ¡×¤Î£µ¤Ä¤ÎÉôʬ¤Ë¿§¤òʬ¤±¤ÆÂ¬¤Ã¤¿¡£~
¤½¤ì¤é¤ÎÃͤϰʲ¼¤Î¿Þ¤Î¤è¤¦¤Ë¤Ê¤Ã¤¿¡£
#ref(2019a/Member/Gouki/Mission2/Hikarinoatai.png,30%);
¥×¥í¥°¥é¥ß¥ó¥°¤Ç¤Ï¡¢¤½¤ì¤¾¤ì¤ÎÃͤò°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤¹¤ë¡£
#define black 20
#define white 50
#define lightgray 40
#define darkgray 28
#define center 35
ÌÀ¤«¤ë¤µ¤ÎÃͤò£µÃʳ¬¤Ëʬ¤±¡¢¤½¤ì¤é¤ËÂбþ¤¹¤ë£µ¤Ä¤Îưºî¤ò¿¶¤êʬ¤±¤ë¡£~
²¼¤Î¿Þ¤¬¤½¤Îưºî¤Ç¤¢¤ê¡¢ÌÀ¤ë¤µ¤ä¾ì¹ç¤Ë¤è¤Ã¤Æ¤É¤Îư¤¤Ë¤Ê¤ë¤«¤Ï°Û¤Ê¤ë¡£
#ref(2019a/Member/Gouki/Mission2/ugokuhoukou.png,30%);
°Ê²¼¤¬¤½¤Îưºî¤òÄêµÁ¤·¤¿¥×¥í¥°¥é¥ß¥ó¥°¤Ç¤¢¤ë¡£
#define turn_right OnFwd(OUT_C,25);OnRev(OUT_B,15);//£
#define turn_left OnFwd(OUT_B,25);OnRev(OUT_C,15);//¤
#define rotate_right OnFwd(OUT_C,20);OnRev(OUT_B,20);//¡
#define rotate_left OnFwd(OUT_B,20);OnRev(OUT_C,20);//¢
#define go_straight OnFwd(OUT_BC,20);//¥
#define go_straight2 OnFwd(OUT_BC,15);//¥¤Î½ÐÎϤò¾¯¤·²¼¤²¤¿¤â¤Î
***º¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ [#ye3aa3a8]
±¦Â¦¤Èº¸Â¦¤È¤Ç¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¤Ï¥×¥í¥°¥é¥ß¥ó¥°¤¬°Û¤Ê¤Ã¤Æ¤¯¤ë¤¿¤á~
¤½¤ì¤¾¤ìʬ¤±¤Æ¹Í¤¨¤ë¡£
sub followline_L(int stop_time)
{
long t0=CurrentTick();
while(CurrentTick()-t0<stop_time){
if(SENSOR_1<black){
rotate_left;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//ÌÀ¤ë¤µ¤¬20¤è¤ê¾®¤µ¤¤¤È¤¢¤Îưºî
}else if(SENSOR_1<darkgray){
turn_left;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//ÌÀ¤ë¤µ¤¬28¤è¤ê¾®¤µ¤¤¤È¤¤¤Îưºî
}else if(SENSOR_1>lightdark){
turn_right;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//ÌÀ¤ë¤µ¤¬35¤è¤ê¾®¤µ¤¤¤È¤£¤Îưºî
}else if(SENSOR_1<center){
go_straight; ¡¡¡¡¡¡ //ÌÀ¤ë¤µ¤¬40¤è¤êÂ礤¤¤È¤¥¤Îưºî
}else{
rotate_right; ¡¡¡¡¡¡ //ÌÀ¤ë¤µ¤¬50¤è¤êÂ礤¤¤È¤¡¤Îưºî
}
}
}
¿å¿§¤ÎÌð°õ¤¬¥×¥í¥°¥é¥ß¥ó¥°¤Çưºî¤¹¤ëÊý¸þ¤Ç¤¢¤ë¡£
#ref(2019a/Member/Gouki/Mission2/InkedHikarinoatai_LI.jpg,30%);
***±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ [#ga54f680]
º¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤ÈƱÍͤ˱¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤â¹Í¤¨¤ë¡£
sub followline_R(int stop_time)
{
long t0=CurrentTick();
while(CurrentTick()-t0<stop_time){
if(SENSOR_1<black){
rotate_right; ¡¡ //ÌÀ¤ë¤µ¤¬20¤è¤ê¾®¤µ¤¤¤È¤¡¤Îưºî
}else if(SENSOR_1<darkgray){
turn_right; ¡¡//ÌÀ¤ë¤µ¤¬28¤è¤ê¾®¤µ¤¤¤È¤£¤Îưºî
}else if(SENSOR_1>lightdark){
turn_left; ¡¡ //ÌÀ¤ë¤µ¤¬35¤è¤ê¾®¤µ¤¤¤È¤¤¤Îưºî
}else if(SENSOR_1<center){
go_straight; ¡¡//ÌÀ¤ë¤µ¤¬40¤è¤êÂ礤¤¤È¤¥¤Îưºî
}else{
rotate_left; ¡¡ //ÌÀ¤ë¤µ¤¬50¤è¤êÂ礤¤¤È¤¢¤Îưºî
}
}
}
#ref(2019a/Member/Gouki/Mission2/Inkedhikari2_LI.jpg,30%);
ÀÖ¿§¤ÎÌð°õ¤¬¥×¥í¥°¥é¥ß¥ó¥°¤Çưºî¤¹¤ëÊý¸þ¤Ç¤¢¤ë¡£
**¸òº¹ÅÀǧ¼± [#pf6b85ac]
¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¤¹¤ëºÝ¤ËÅÓÃæ¤Ç¸òº¹ÅÀ¤Ë¤µ¤·¤«¤«¤ë¡£¤½¤Î¤Þ¤Þ¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¤·¤Æ¤·¤Þ¤¦¤È³Ñ¤Ë±è¤Ã¤Æ¤½¤Î¤Þ¤Þ¶Ê¤¬¤Ã¤Æ¤¤¤Ã¤Æ¤·¤Þ¤¦¡£~
¤½¤Î¤¿¤á¤Ë¸òº¹ÅÀ¤òǧ¼±¤¹¤ë¥×¥í¥°¥é¥ß¥ó¥°¤òºîÀ®¤¹¤ë¡£¤½¤ì¤Ï¡¢¥é¥¤¥ó¥È¥ì¡¼¥¹Ãæ¤ËÆÃÄê¤Îưºî¤ò»ØÄꤷ¤¿²¿Éô֤«¹Ô¤Ã¤¿¾ì¹ç¤Ë¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò½ªÎ»¤µ¤»¤ë¤È¤¤¤¦¤â¤Î¤À¡£
Ëô¡¢º£²ó¤Ï¸òº¹ÅÀ¤òǧ¼±¤·¤¿ºÝ¤Ë¡¢¿ôÉôÖÄä»ß¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Î¤Ç¡¢¿ôÉôÖÄä»ß¤¹¤ë¥×¥í¥°¥é¥ß¥ó¥°¤â¥é¥¤¥ó¥È¥ì¡¼¥¹¤ÎÃæ¤ËÉÕ¤±²Ã¤¨¤ë¡£
***º¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¸òº¹ÅÀǧ¼± [#o18ba70d]
º¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¾ì¹ç¡¢¡Ö¹õ¡×¤È¡Ö¹õ¤È¶Ìܤδ֡פ΢¤È¤¤Îưºî¤¬~
Ϣ³¤Ç²¿Éô֤«Æ°ºî¤·¤¿¤È¤¤Ë¡¢»ß¤Þ¤ë¤è¤¦¤Ë¤¹¤ë¡£
»Ï¤á¤Ët0=CurrentTick¤È¤ª¤¡¢¤½¤ì¤¾¤ì¤ÎÊÑ¿ô¤ÎÃͤκ¹(CurrentTick()-t0)¤Ï0¤Ç¤¢¤ë¡£t0=CurrentTick¤ò²¼¤Î¥×¥í¥°¥é¥à¤Î¤è¤¦¤Ë~
if¤äelse if¤Î¤Ê¤«¤Ë¤¤¤ì¡¢¤½¤ì¤ò¥í¥Ü¥Ã¥È¤¬Ç§¼±¤¹¤ë¤¿¤Ó¤Ë¤³¤ÎÊÑ¿ô¤ÎÃͤκ¹¤Ï0(to=CurrentTick)¤È¤Ê¤ë¡£¤½¤ì¤Ï~
to=CurrentTick¤ÈÆþ¤ì¤Æ¤¤¤Ê¤¤¤È¤½¤ì¤¾¤ì¤ÎÊÑ¿ô¤Îº¹¤Ï0¤Ë¹¹¿·¤µ¤ì¤ºÁý¤¨Â³¤±¤ë¤³¤È¤Ë¤Ê¤ë¡£~
¤¹¤Ê¤ï¤Áif¤äelse if¤ÎÃæ¤Ëto=CurrentTick¤È¤¤¤ì¤Ê¤¤¤Ê¤é¤Ð¡¢¥í¥Ü¥Ã¥È¤Ïto=CurrentTick¤òǧ¼±¤¹¤ë¤³¤È¤Ï~
½ÐÍ褺¡¢¤½¤ì¤¾¤ì¤ÎÊÑ¿ô¤Îº¹¤Ï0¤Ë¤Ê¤é¤ºto=CurrentTick¤ÈÆþ¤Ã¤Æ¤¤¤Ê¤¤if¤äelse if¤Îưºî¤ò¼Â¹Ô¤·¤Æ¤¤¤ëºÝ¤Ï~
¤³¤ÎÊÑ¿ô¤ÎÃÍ¡ÊCurrentTick¡Ë¤ÏÁý¤¨Â³¤±¤Æ¤¤¤ë¤Î¤Ç¤¢¤ë¡£¤½¤·¤Æ¡¢¤½¤ì¤¾¤ì¤ÎÊÑ¿ô¤Îº¹(CurrentTick()-t0)¤Ë²¼µ¤Î¥×¥í¥°¥é¥à¤Îstop_time¤Î¤è¤¦¤Ë¾å¸Â¤òÀߤ±¡¢stop_time¤Ë¤ÏÆÃÄê¤ÎÃͤòÆþ¤ì¤ë¡£¤³¤¦¤¹¤ë¤³¤È¤Ç¡¢CurrentTick()-t0~
¤¬stop_time¤ËÆþ¤ì¤¿Ãͤλþ´Öʬ¤òͤ¹¤Èwhile¤Îưºî¤òÄä»ß¤·¡¢¼¡¤Îưºî¤Ç¤¢¤ëOff(OUT_BC);Wait(1000);~
¤ò¼Â¹Ô¤·¡¢¥í¥Ü¥Ã¥È¤Ï1Éôֻߤޤ롣¤³¤ì¤¬¥×¥í¥°¥é¥àÃæ¤Ît0=CurrentTick()¤È(CurrentTick()-t0<stop_time~
¤Î°ÕÌ£¹ç¤¤¤È¤Ê¤ë¡£~
¤½¤·¤Æº¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¾ì¹ç if(SENSOR_1<black)¤Èelse if(SENSOR_1<darkgray)¤Ë~
t0=CurrentTick();¤¬Æþ¤Ã¤Æ¤ª¤é¤ºblack¤¹¤Ê¤ï¤Á20¤è¤ê¾®¤µ¤¤ÃÍ¡¢darkgray¤¹¤Ê¤ï¤Á28¤è¤ê¾®¤µ¤¤ÃÍ~
¤ò¸¡ÃΤ·¤¿»þ´Ö¤¬stop_time¤ÎÃͤλþ´Öʬ¤òĶ²á¤·¤¿¾ì¹ç¤Ë¤Ïwhile¤Îưºî¤òÄä»ß¤·¡¢¼¡¤Îưºî¤Ç¤¢¤ëOff(OUT_BC);Wait(1000);~
¤ò¼Â¹Ô¤·¡¢¥í¥Ü¥Ã¥È¤Ï1Éôֻߤޤë
sub followline_L(int stop_time)
{
long t0=CurrentTick();
while(CurrentTick()-t0<stop_time){¡¡//stop_time¤Ë¤¤¤ì¤¿ÃͤòĶ²á¤¹¤ë¤È¼¡¤Î¥×¥í¥°¥é¥à¤Ø
if(SENSOR_1<black){ //black¤¹¤Ê¤ï¤Á20¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤ØÀû²ó
rotate_left;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}else if(SENSOR_1<darkgray){¡¡¡¡//darkgray¤¹¤Ê¤ï¤Á28¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤Ø
turn_left; ¡¡¡¡¡¡ //¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}else if(SENSOR_1>lightdark){¡¡¡¡//lightdray¤¹¤Ê¤ï¤Á40¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤Ø¶Ê¤¬¤ë
turn_right; ¡¡¡¡¡¡ //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else if(SENSOR_1<center){¡¡¡¡¡¡//center¤¹¤Ê¤ï¤Á35¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èľ¿Ê¤¹¤ë
go_straight; ¡¡¡¡¡¡ //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else{¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//white¤¹¤Ê¤ï¤Á50¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤ØÀû²ó
rotate_right; ¡¡¡¡¡¡ //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}
}
Off(OUT_BC);
Wait(1000);
}
***±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¸òº¹ÅÀǧ¼± [#z33fa8be]
±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¾ì¹ç¡¢¡Ö¹õ¡×¤È¡Ö¹õ¤È¶Ìܤδ֡פΡ¤È£¤Îưºî¤¬~
Ϣ³¤Ç²¿Éô֤«Æ°ºî¤·¤¿¤È¤¤Ë¡¢»ß¤Þ¤ë¤è¤¦¤Ë¤¹¤ë¡£~
¤³¤Î¸¶Íý¤Ïº¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¾ì¹ç¤ÈƱ¤¸¤È¤Ê¤ë¡£
sub followline_R(int stop_time)
{
long t0=CurrentTick();
while(CurrentTick()-t0<stop_time){¡¡//stop_time¤Ë¤¤¤ì¤¿ÃͤòĶ²á¤¹¤ë¤È¼¡¤Î¥×¥í¥°¥é¥à¤Ø
if(SENSOR_1<black){ //black¤¹¤Ê¤ï¤Á20¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤ØÀû²ó
rotate_right; //¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}else if(SENSOR_1<darkgray){¡¡¡¡//darkgray¤¹¤Ê¤ï¤Á28¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤Ø
turn_right; //¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}else if(SENSOR_1>lightdark){¡¡¡¡//lightdray¤¹¤Ê¤ï¤Á40¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤Ø¶Ê¤¬¤ë
turn_left; //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else if(SENSOR_1<center){¡¡¡¡¡¡//center¤¹¤Ê¤ï¤Á35¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èľ¿Ê¤¹¤ë
go_straight; //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else{¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//white¤¹¤Ê¤ï¤Á50¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤ØÀû²ó
rotate_left; //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}
}
Off(OUT_BC);
Wait(1000);
}
Ëô¡¢¥³¡¼¥¹¤ÎÅÓÃæ¤Îk¤«¤éL¤Ë¸þ¤«¤¤¡¢L¤Ç»ß¤Þ¤ë¥×¥í¥°¥é¥ß¥ó¥°¤ò¹Í¤¨¤¿·ë²Ì¡¢~
±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¡ÖÇò¡×¤È¡ÖÇò¤Î¶Ìܡפ΢¤È¤¤Îưºî¤òϢ³¤Ç¹Ô¤¦¤È~
»ß¤Þ¤ë¥×¥í¥°¥é¥ß¥ó¥°¤¬´°À®¤·¤¿¡£
¤³¤Î¾ì¹çelse if(SENSOR_1>lightdark) ¤Èelse¤Ë~
t0=CurrentTick();¤¬Æþ¤Ã¤Æ¤ª¤é¤ºlightdray¤¹¤Ê¤ï¤Á40¤è¤êÂ礤¤ÃÍ¡¢white¤¹¤Ê¤ï¤Á50¤è¤êÂ礤¤ÃÍ~
¤ò¸¡ÃΤ·¤¿»þ´Ö¤¬stop_time¤ÎÃͤλþ´Öʬ¤òĶ²á¤·¤¿¾ì¹ç¤Ë¤Ïwhile¤Îưºî¤òÄä»ß¤·¡¢¼¡¤Îưºî¤Ç¤¢¤ëOff(OUT_BC);Wait(1000);~
¤ò¼Â¹Ô¤·¡¢¥í¥Ü¥Ã¥È¤Ï1Éôֻߤޤ롣
#ref(2019a/Member/Gouki/Mission2/Inked2019a-mission23_LI.jpg,70%);
sub followline_R2(int stop_time)
{
long t0=CurrentTick();
while(CurrentTick()-t0<stop_time){¡¡//stop_time¤Ë¤¤¤ì¤¿ÃͤòĶ²á¤¹¤ë¤È¼¡¤Î¥×¥í¥°¥é¥à¤Ø
if(SENSOR_1<black){ //black¤¹¤Ê¤ï¤Á20¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤ØÀû²ó
rotate_right;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else if(SENSOR_1<darkgray){¡¡ ¡¡//darkgray¤¹¤Ê¤ï¤Á28¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤Ø
turn_right; //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else if(SENSOR_1>lightdark){¡¡ ¡¡//lightdray¤¹¤Ê¤ï¤Á40¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤Ø¶Ê¤¬¤ë
turn_left; //¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}else if(SENSOR_1<center){¡¡ ¡¡¡¡//center¤¹¤Ê¤ï¤Á35¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èľ¿Ê¤¹¤ë
go_straight2; //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else{¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ¡¡//white¤¹¤Ê¤ï¤Á50¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤ØÀû²ó
rotate_left; //¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}
}
Off(OUT_BC);
Wait(2000);
}
**¸òº¹ÅÀ²£ÃÇ [#z69f3aff]
¸òº¹ÅÀ¤òǧ¼±¤·¤¿¸å¡¢Ä¾¿Ê¡¢º¸ÀÞ¡¢±¦ÀÞ¤ÎÆ°ºî¤ò¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£~
¤½¤³¤Ç»ä¤¿¤Á¤Ï¡¢¤¢¤ëÃͤò¸¡ÃΤ¹¤ë¤Þ¤Ç°ìÄê¤Îưºî¤ò¹Ô¤¤Â³¤±¤ë¥×¥í¥°¥é¥ß¥ó¥°¤òºî¤Ã¤¿¡£
¡ûľ¿Ê~
28¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ·¤Æ¤¤¤ë»þ¤Ïľ¿Ê¤·¡¢~
28¤è¤êÂ礤¤Ãͤò¸¡ÃΤ·¤¿¤é»ß¤Þ¤ë¡£
¢ª¹õ¤¤Àþ¾å¤Ç¤Ïľ¿Ê
sub Blackto_White()
{
while(SENSOR_1<darkgray){¡¡ ¡¡//darkdray¤¹¤Ê¤ï¤Á28¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èľ¿Ê¤¹¤ë
OnFwd(OUT_BC,15);
}
Off(OUT_BC);
}
¡û±¦ÀÞ~
40¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ·¤Æ¤¤¤ë»þ¤Ï±¦ÀÞ¤·¡¢~
40¤è¤êÂ礤¤Ãͤò¸¡ÃΤ·¤¿¤é»ß¤Þ¤ë¡£
¢ª¹õ¤¤Àï¾ì¤Ç¤Ï±¦ÀÞ
sub Blackto_White_R()
{
while(SENSOR_1<lightgray){¡¡ ¡¡//lightdray¤¹¤Ê¤ï¤Á40¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤ØÀû²ó
OnFwd(OUT_C,20);
OnRev(OUT_B,20);
}
Off(OUT_BC);
}
¡ûº¸ÀÞ~
40¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ·¤Æ¤¤¤ë»þ¤Ïº¸ÀÞ¤·¡¢~
40¤è¤êÂ礤¤Ãͤò¸¡ÃΤ·¤¿¤é»ß¤Þ¤ë¡£
¢ª¹õ¤¤Àï¾ì¤Ç¤Ïº¸ÀÞ
sub Blackto_White_L()
{
while(SENSOR_1<lightgray){¡¡ ¡¡//lightdray¤¹¤Ê¤ï¤Á40¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤ØÀû²ó
OnFwd(OUT_B,20);
OnRev(OUT_C,20);
}
Off(OUT_BC);
}
**¥Ü¡¼¥ë [#m8834b2f]
º£½©¤Î²ÝÂê¤Ç¤Ï¥³¡¼¥¹¤ÎÅÓÃæ¤Ç¥Ü¡¼¥ë¤ò¤Ä¤«¤ß¡¢~
¥Ü¡¼¥ë¤ò±¿¤ó¤Ç¡¢ºÇ¸å¤Ë¥´¡¼¥ë¤·¤Ê¤±¤ì¤Ð¤¤¤±¤Ê¤¤¤Î¤Ç~
¤Ä¤«¤à¤¿¤á¤Î¥×¥í¥°¥é¥à¤È¥´¡¼¥ë¤¹¤ë¤¿¤á¤Î¥×¥í¥°¥é¥à¤òºîÀ®¤¹¤ë¡£
***¥Ü¡¼¥ë¤ò¤È¤ë¤¿¤á¤Î¥×¥í¥°¥é¥à [#e0f200a7]
#define catch OnRev(OUT_A,25);Wait(500);Off(OUT_A);
***¥Ü¡¼¥ë¤òÎ¥¤·¡¢¥´¡¼¥ë¤¹¤ë¤¿¤á¤Î¥×¥í¥°¥é¥à [#da74ff35]
¥´¡¼¥ë¤¹¤ëÊýË¡¤Ï¡¢¥Ü¡¼¥ë¤òÎ¥¤·¤¿ºÝ¤ËËÜÂΤǥ³¥Ä¥ó¤È²¡¤·½Ð¤¹¤È¤¤¤¦¤â¤Î¤À¡£~
¤½¤Î¤¿¤áºÇ¸å¤Îưºî¤Î½ÐÎϤÏÂçÉý¤Ë¾å¤²¤Æ¤¢¤ë¡£~
#define release OnFwd(OUT_A,25);Wait(500);Off(OUT_A);
#define osidasi OnFwd(OUT_BC,100);Wait(100);Off(OUT_BC);
***¥Ü¡¼¥ë¤ò¤È¤Ã¤¿¸å [#uc47bf2f]
¥Ü¡¼¥ë¤ò¤È¤Ã¤¿¤é¤¢¤ëÄøÅÙº¸¤ËÀû²ó¤µ¤»¡¢±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ë¤Ä¤Ê¤²¤ë¤è¤¦¤Ë¤¹¤ë¡£
#define turn OnFwd(OUT_B,25);OnRev(OUT_C,25);Wait(1500);Off(OUT_BC);
*¥³¡¼¥¹¤òư¤¯Î®¤ì [#f050659c]
ºÇ½ªÅª¤Ë¤Ï²¼µ¤Î¤è¤¦¤Êή¤ì¤Çưºî¤ò¹Ô¤¦¡£
#ref(2019a/Member/Gouki/Mission2/Inked2019a-mission234_LI.jpg,70%);
task main()
{
SetSensorLight(S1);
followline_L(200);¡¡¡¡¡¡//1
Blackto_White(); //2
followline_L(150); //3
Blackto_White_R(); //4
followline_R(200); //5
Blackto_White_R(); //6
followline(150); //7
Blackto_White_R(); //8
followline(150); //9
Blackto_White_R(); //10
followline(150); //11
Blackto_White(); //12
followline_R2(200); //13
catch; //¥Ü¡¼¥ë¤ò¤Ä¤«¤à
turn; //º¸¤ËÀû²ó¤¹¤ë
followline_R(150); //14
Blackto_White(); //15
followline_R(150); //16
Blackto_White_L(); //17
followline_R(150); //18
release; //¥Ü¡¼¥ë¤òÎ¥¤¹
osidasi; //¥´¡¼¥ë¤¹¤ë
}
*Á´ÂÎ¤Î¥×¥í¥°¥é¥à [#t0578dcf]
#define turn_right OnFwd(OUT_C,25);OnRev(OUT_B,15);
#define turn_left OnFwd(OUT_B,25);OnRev(OUT_C,15);
#define rotate_right OnFwd(OUT_C,20);OnRev(OUT_B,20);
#define rotate_left OnFwd(OUT_B,20);OnRev(OUT_C,20);
#define go_straight OnFwd(OUT_BC,20);
#define go_straight2 OnFwd(OUT_BC,15);
#define turn OnFwd(OUT_B,25);OnRev(OUT_C,25);Wait(1500);Off(OUT_BC);
#define catch OnRev(OUT_A,25);Wait(500);Off(OUT_A);
#define release OnFwd(OUT_A,25);Wait(500);Off(OUT_A);
#define osidasi OnFwd(OUT_BC,100);Wait(100);Off(OUT_BC);
#define black 20
#define white 50
#define lightgray 40
#define darkgray 28
#define center 35
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>lightdark){
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>lightdark){
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>lightdark){
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<darkgray){
OnFwd(OUT_BC,15);
}
Off(OUT_BC);
}
sub Blackto_White_R()
{
while(SENSOR_1<lightgray){
OnFwd(OUT_C,20);
OnRev(OUT_B,20);
}
Off(OUT_BC);
}
sub Blackto_White_L()
{
while(SENSOR_1<lightgray){
OnFwd(OUT_B,20);
OnRev(OUT_C,20);
}
Off(OUT_BC);
}
task main()
{
SetSensorLight(S1);
followline_L(200);
Blackto_White();
followline_L(150);
Blackto_White_R();
followline_R(200);
Blackto_White_R();
followline(150);
Blackto_White_R();
followline(150);
Blackto_White_R();
followline(150);
Blackto_White();
followline_R2(200);
catch;
turn;
followline_R(150);
Blackto_White();
followline_R(150);
Blackto_White_L();
followline_R(150);
release;
osidasi;
}
*¤Þ¤È¤á [#y2be8016]
º£²ó¤Î²ÝÂê¤Ç¤Ï¡¢¥ß¥¹¤ò¤»¤º¤¤Á¤ó¤È´°Áö¤µ¤»¡¢¥´¡¼¥ë¤¹¤ë¤³¤È¤¬½ÐÍ褿¡£~
¥í¥Ü¥Ã¥È¤Îµ¡ÂΤȤ·¤Æ¤Î½ÐÍè¤â¤è¤¯¤¤Á¤ó¤ÈÁö¤Ã¤Æ¤¯¤ì¤¿¤¬¡¢½ê¡¹ÅÅÃӤΤ»¤¤¤Ê¤Î¤«~
ư¤¤¬Æß¤¯¤Ê¤ë»þ¤¬¤¢¤Ã¤¿¡£
·ë²Ì¤À¤±¤ò¸«¤ë¤ÈÎɤ«¤Ã¤¿¤â¤Î¤Î¡¢¤Þ¤À¥×¥í¥°¥é¥ß¥ó¥°¤Ë¤«¤±¤ë»þ´Ö¤¬Ä¹¤¯~
;·×¤Ê¥×¥í¥°¥é¥à¤â¤¢¤ë¡£
º£¡¹¹Í¤¨¤Æ¤ß¤ë¤È¡¢ÅÓÃæ¤Îº¸Àû²ó¤Ï¤¤¤é¤Ê¤¯¤Æ¡¢¤½¤Î¤Þ¤Þ¥é¥¤¥ó¥È¥ì¡¼¥¹~
¤µ¤»¤ì¤Ð¥×¥í¥°¥é¥à¤¬¤â¤Ã¤Èû¤¯¤Ê¤ë¤È»×¤Ã¤¿¡£~
¤Þ¤À¤Þ¤À¡¢¥×¥í¥°¥é¥à¤ÎÌ̤Ç;·×¤Ê¤È¤³¤í¤¬¤¢¤ë¤È»×¤¦¤Î¤Ç¡¢~
¼¡¤Î²ÝÂê¤Ç¤Ï¤½¤Î¤è¤¦¤Ê¥ß¥¹¤ò¸º¤é¤·¤Æ¡¢´Ê·é¤Ç¤è¤ê¤è¤¤¥×¥í¥°¥é¥à¤Ë~
»Å¾å¤²¤é¤ì¤ë¤è¤¦¤Ë¤·¤¿¤¤¤È»×¤¦¡£
½ªÎ»¹Ô:
Ìܼ¡
#contents
*²ÝÂê¤Ë¤Ä¤¤¤Æ [#xd5df109]
²¼¤Î¤è¤¦¤Ê¿Þ¤ò¥Á¡¼¥à¤´¤È¤ËºîÀ®¤·¡¢¹õ¤¤Àþ¤Î¾å¤òÁö¤ë¤è¤¦¤Ê¥í¥Ü¥Ã¥È¤òºîÀ®¤¹¤ë¡£
#ref(2019a/Member/Gouki/Mission2/2019a-mission2.png,70%);
**²ÝÂê¤Î¾ÜºÙ [#f419cc01]
AÃÏÅÀ¤ò½Ðȯ¤·¡¢¼¡¤Î·ÐÏ©¤ò¹õ¤¤Àþ¤Ë¤½¤Ã¤ÆÆ°¤¡¢ºÇ¸å¤Ë¥Ô¥ó¥Ý¥óµå¤ò¥´¡¼¥ë¤ËÆþ¤ì¤ë¥í¥Ü¥Ã¥È¤òºîÀ®¤¹¤ë
#ref(2019a/Member/Gouki/Mission2/Inked2019a-mission2_LI.jpg,70%);
¡AÃÏÅÀ¤«¤é½Ðȯ
¢B¤òľ¿Ê
£C¤òľ¿Ê
¤D¤ò°ì»þÄä»ß¤Î¸å¤Ëľ¿Ê
¥E¤òľ¿Ê
¦F¤òľ¿Ê
§G¤ò°ì»þÄä»ß¤Î¸å¤Ë±¦ÀÞ
¨H¤òľ¿Ê
©I¤òľ¿Ê
ªJ¤ò±¦ÀÞ
«K¤òº¸ÀÞ
¬L¤Ç¥Ô¥ó¥Ý¥ó¶Ì¤ò¤Ä¤«¤à
K¤òľ¿Ê
®M¤Ç°ì»þÄä»ß
¯¥·¥å¡¼¥È
°AÃÏÅÀ¤ËÆþ¤ë(¥´¡¼¥ë)
*¥í¥Ü¥Ã¥ÈËÜÂΤˤĤ¤¤Æ [#d3ddfb99]
**¥í¥Ü¥Ã¥ÈÁ´ÂÎ [#f2f596ad]
#ref(2019a/Member/Gouki/Mission2/line_175788711878042.jpg,30%);
º£²ó¤Îµ¡ÂΤòÀ©ºî¤¹¤ë¤Ë¤¢¤¿¤ê¡¢¿Þ¾å¤Ç¤¤Á¤ó¤È¾®²ó¤ê¤¬¤¤¯¤è¤¦¤Ë¡¢¤Ê¤ë¤Ù¤¯¾®¤µ¤¤¥í¥Ü¥Ã¥È¤Ë¤·¤¿¡£~
**¸÷¥»¥ó¥µ¡¼Éôʬ [#z7f7e944]
#ref(2019a/Member/Gouki/Mission2/line_175812470413242.jpg,30%);
¸÷¥»¥ó¥µ¡¼¤Î¾ì½ê¤Ï¡¢¶á¤¹¤®¤º±ó¤¹¤®¤º¤Ê¤ë¤Ù¤¯Àµ³Î¤ÊÃͤò¿Þ¤ì¤ë¤è¤¦¤Ë¤·¤¿¡£
**¥¿¥¤¥äÉôʬ [#o8ddbba8]
#ref(2019a/Member/Gouki/Mission2/line_175792940901791.jpg,30%);
¥¿¥¤¥ä¤Ï¤Ê¤ë¤Ù¤¯¸÷¥»¥ó¥µ¡¼¤Ë¶á¤¯¤Ê¤ë¤è¤¦¤ËÀ߷פ·¤¿¡£~
Íýͳ¤È¤·¤Æ¤Ï¡¢¸÷¤ò¸¡ÃΤ·¡¢¥¿¥¤¥ä¤ò¤¤¤ÁÁ᤯¸¡ÃΤ·¤¿¸÷¤ÎÃͤλþ¤Î¥×¥í¥°¥é¥à¤ò¼Â¹Ô¤µ¤»¡¢Æ°ºî¤¹¤ë¾å¤Ç¤Î¸íº¹¤ò¤Ê¤¯¤¹¤¿¤á¤À¡£
**¤Ä¤«¤àµ¡¹½ [#q8a37cf4]
#ref(2019a/Member/Gouki/Mission2/line_175760293908939.jpg,30%);
#ref(2019a/Member/Gouki/Mission2/Inkedline_175750132339776_LI.jpg,30%);
¥¢¡¼¥à¤Î³«ÊĤι½Â¤¤Ï¿Þ¤ò¸«¤Æ¤â¤é¤Ã¤¿Êý¤¬Ê¬¤«¤ê¤ä¤¹¤¤¤¬¡¢~
¡¥â¡¼¥¿¡¼¤ò¸þ¤«¤Ã¤Æ¾å¤«¤é¾åÊý¸þ¤Ë²ó¤¹¤È¥¢¡¼¥à¤ò³«¤¯~
¢¥â¡¼¥¿¡¼¤ò¸þ¤«¤Ã¤Æ¾å¤«¤é²¼Êý¸þ¤Ë²ó¤¹¤È¥¢¡¼¥à¤¬ÊĤ¸¤ë~
*¸Ä¡¹¤Î¥×¥í¥°¥é¥à¤Ë¤Ä¤¤¤Æ [#x8c757c8]
**¥é¥¤¥ó¥È¥ì¡¼¥¹ [#ja65743e]
º£²ó¤Ï¡¢¹õ¤¤Àþ¤òÄɽ¾¤¹¤ë¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¥×¥í¥°¥é¥ß¥ó¥°¤òºî¤é¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£~
¤Þ¤º¤Ï¸÷¤ÎÃͤò¬¤ë¡£»ä¤¿¤Á¤Ï¡Ö´°Á´¤Ë¿¿¤ÃÇò¡×¡¢¡ÖÇò¤È¶Ìܤδ֡ס¢¡Ö¶Ìܡס¢¡Ö¹õ¤È¶Ìܤδ֡ס¢~
¡Ö´°Á´¤Ë¹õ¡×¤Î£µ¤Ä¤ÎÉôʬ¤Ë¿§¤òʬ¤±¤ÆÂ¬¤Ã¤¿¡£~
¤½¤ì¤é¤ÎÃͤϰʲ¼¤Î¿Þ¤Î¤è¤¦¤Ë¤Ê¤Ã¤¿¡£
#ref(2019a/Member/Gouki/Mission2/Hikarinoatai.png,30%);
¥×¥í¥°¥é¥ß¥ó¥°¤Ç¤Ï¡¢¤½¤ì¤¾¤ì¤ÎÃͤò°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤¹¤ë¡£
#define black 20
#define white 50
#define lightgray 40
#define darkgray 28
#define center 35
ÌÀ¤«¤ë¤µ¤ÎÃͤò£µÃʳ¬¤Ëʬ¤±¡¢¤½¤ì¤é¤ËÂбþ¤¹¤ë£µ¤Ä¤Îưºî¤ò¿¶¤êʬ¤±¤ë¡£~
²¼¤Î¿Þ¤¬¤½¤Îưºî¤Ç¤¢¤ê¡¢ÌÀ¤ë¤µ¤ä¾ì¹ç¤Ë¤è¤Ã¤Æ¤É¤Îư¤¤Ë¤Ê¤ë¤«¤Ï°Û¤Ê¤ë¡£
#ref(2019a/Member/Gouki/Mission2/ugokuhoukou.png,30%);
°Ê²¼¤¬¤½¤Îưºî¤òÄêµÁ¤·¤¿¥×¥í¥°¥é¥ß¥ó¥°¤Ç¤¢¤ë¡£
#define turn_right OnFwd(OUT_C,25);OnRev(OUT_B,15);//£
#define turn_left OnFwd(OUT_B,25);OnRev(OUT_C,15);//¤
#define rotate_right OnFwd(OUT_C,20);OnRev(OUT_B,20);//¡
#define rotate_left OnFwd(OUT_B,20);OnRev(OUT_C,20);//¢
#define go_straight OnFwd(OUT_BC,20);//¥
#define go_straight2 OnFwd(OUT_BC,15);//¥¤Î½ÐÎϤò¾¯¤·²¼¤²¤¿¤â¤Î
***º¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ [#ye3aa3a8]
±¦Â¦¤Èº¸Â¦¤È¤Ç¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¤Ï¥×¥í¥°¥é¥ß¥ó¥°¤¬°Û¤Ê¤Ã¤Æ¤¯¤ë¤¿¤á~
¤½¤ì¤¾¤ìʬ¤±¤Æ¹Í¤¨¤ë¡£
sub followline_L(int stop_time)
{
long t0=CurrentTick();
while(CurrentTick()-t0<stop_time){
if(SENSOR_1<black){
rotate_left;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//ÌÀ¤ë¤µ¤¬20¤è¤ê¾®¤µ¤¤¤È¤¢¤Îưºî
}else if(SENSOR_1<darkgray){
turn_left;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//ÌÀ¤ë¤µ¤¬28¤è¤ê¾®¤µ¤¤¤È¤¤¤Îưºî
}else if(SENSOR_1>lightdark){
turn_right;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//ÌÀ¤ë¤µ¤¬35¤è¤ê¾®¤µ¤¤¤È¤£¤Îưºî
}else if(SENSOR_1<center){
go_straight; ¡¡¡¡¡¡ //ÌÀ¤ë¤µ¤¬40¤è¤êÂ礤¤¤È¤¥¤Îưºî
}else{
rotate_right; ¡¡¡¡¡¡ //ÌÀ¤ë¤µ¤¬50¤è¤êÂ礤¤¤È¤¡¤Îưºî
}
}
}
¿å¿§¤ÎÌð°õ¤¬¥×¥í¥°¥é¥ß¥ó¥°¤Çưºî¤¹¤ëÊý¸þ¤Ç¤¢¤ë¡£
#ref(2019a/Member/Gouki/Mission2/InkedHikarinoatai_LI.jpg,30%);
***±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹ [#ga54f680]
º¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤ÈƱÍͤ˱¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤â¹Í¤¨¤ë¡£
sub followline_R(int stop_time)
{
long t0=CurrentTick();
while(CurrentTick()-t0<stop_time){
if(SENSOR_1<black){
rotate_right; ¡¡ //ÌÀ¤ë¤µ¤¬20¤è¤ê¾®¤µ¤¤¤È¤¡¤Îưºî
}else if(SENSOR_1<darkgray){
turn_right; ¡¡//ÌÀ¤ë¤µ¤¬28¤è¤ê¾®¤µ¤¤¤È¤£¤Îưºî
}else if(SENSOR_1>lightdark){
turn_left; ¡¡ //ÌÀ¤ë¤µ¤¬35¤è¤ê¾®¤µ¤¤¤È¤¤¤Îưºî
}else if(SENSOR_1<center){
go_straight; ¡¡//ÌÀ¤ë¤µ¤¬40¤è¤êÂ礤¤¤È¤¥¤Îưºî
}else{
rotate_left; ¡¡ //ÌÀ¤ë¤µ¤¬50¤è¤êÂ礤¤¤È¤¢¤Îưºî
}
}
}
#ref(2019a/Member/Gouki/Mission2/Inkedhikari2_LI.jpg,30%);
ÀÖ¿§¤ÎÌð°õ¤¬¥×¥í¥°¥é¥ß¥ó¥°¤Çưºî¤¹¤ëÊý¸þ¤Ç¤¢¤ë¡£
**¸òº¹ÅÀǧ¼± [#pf6b85ac]
¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¤¹¤ëºÝ¤ËÅÓÃæ¤Ç¸òº¹ÅÀ¤Ë¤µ¤·¤«¤«¤ë¡£¤½¤Î¤Þ¤Þ¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò¤·¤Æ¤·¤Þ¤¦¤È³Ñ¤Ë±è¤Ã¤Æ¤½¤Î¤Þ¤Þ¶Ê¤¬¤Ã¤Æ¤¤¤Ã¤Æ¤·¤Þ¤¦¡£~
¤½¤Î¤¿¤á¤Ë¸òº¹ÅÀ¤òǧ¼±¤¹¤ë¥×¥í¥°¥é¥ß¥ó¥°¤òºîÀ®¤¹¤ë¡£¤½¤ì¤Ï¡¢¥é¥¤¥ó¥È¥ì¡¼¥¹Ãæ¤ËÆÃÄê¤Îưºî¤ò»ØÄꤷ¤¿²¿Éô֤«¹Ô¤Ã¤¿¾ì¹ç¤Ë¥é¥¤¥ó¥È¥ì¡¼¥¹¤ò½ªÎ»¤µ¤»¤ë¤È¤¤¤¦¤â¤Î¤À¡£
Ëô¡¢º£²ó¤Ï¸òº¹ÅÀ¤òǧ¼±¤·¤¿ºÝ¤Ë¡¢¿ôÉôÖÄä»ß¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤Î¤Ç¡¢¿ôÉôÖÄä»ß¤¹¤ë¥×¥í¥°¥é¥ß¥ó¥°¤â¥é¥¤¥ó¥È¥ì¡¼¥¹¤ÎÃæ¤ËÉÕ¤±²Ã¤¨¤ë¡£
***º¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¸òº¹ÅÀǧ¼± [#o18ba70d]
º¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¾ì¹ç¡¢¡Ö¹õ¡×¤È¡Ö¹õ¤È¶Ìܤδ֡פ΢¤È¤¤Îưºî¤¬~
Ϣ³¤Ç²¿Éô֤«Æ°ºî¤·¤¿¤È¤¤Ë¡¢»ß¤Þ¤ë¤è¤¦¤Ë¤¹¤ë¡£
»Ï¤á¤Ët0=CurrentTick¤È¤ª¤¡¢¤½¤ì¤¾¤ì¤ÎÊÑ¿ô¤ÎÃͤκ¹(CurrentTick()-t0)¤Ï0¤Ç¤¢¤ë¡£t0=CurrentTick¤ò²¼¤Î¥×¥í¥°¥é¥à¤Î¤è¤¦¤Ë~
if¤äelse if¤Î¤Ê¤«¤Ë¤¤¤ì¡¢¤½¤ì¤ò¥í¥Ü¥Ã¥È¤¬Ç§¼±¤¹¤ë¤¿¤Ó¤Ë¤³¤ÎÊÑ¿ô¤ÎÃͤκ¹¤Ï0(to=CurrentTick)¤È¤Ê¤ë¡£¤½¤ì¤Ï~
to=CurrentTick¤ÈÆþ¤ì¤Æ¤¤¤Ê¤¤¤È¤½¤ì¤¾¤ì¤ÎÊÑ¿ô¤Îº¹¤Ï0¤Ë¹¹¿·¤µ¤ì¤ºÁý¤¨Â³¤±¤ë¤³¤È¤Ë¤Ê¤ë¡£~
¤¹¤Ê¤ï¤Áif¤äelse if¤ÎÃæ¤Ëto=CurrentTick¤È¤¤¤ì¤Ê¤¤¤Ê¤é¤Ð¡¢¥í¥Ü¥Ã¥È¤Ïto=CurrentTick¤òǧ¼±¤¹¤ë¤³¤È¤Ï~
½ÐÍ褺¡¢¤½¤ì¤¾¤ì¤ÎÊÑ¿ô¤Îº¹¤Ï0¤Ë¤Ê¤é¤ºto=CurrentTick¤ÈÆþ¤Ã¤Æ¤¤¤Ê¤¤if¤äelse if¤Îưºî¤ò¼Â¹Ô¤·¤Æ¤¤¤ëºÝ¤Ï~
¤³¤ÎÊÑ¿ô¤ÎÃÍ¡ÊCurrentTick¡Ë¤ÏÁý¤¨Â³¤±¤Æ¤¤¤ë¤Î¤Ç¤¢¤ë¡£¤½¤·¤Æ¡¢¤½¤ì¤¾¤ì¤ÎÊÑ¿ô¤Îº¹(CurrentTick()-t0)¤Ë²¼µ¤Î¥×¥í¥°¥é¥à¤Îstop_time¤Î¤è¤¦¤Ë¾å¸Â¤òÀߤ±¡¢stop_time¤Ë¤ÏÆÃÄê¤ÎÃͤòÆþ¤ì¤ë¡£¤³¤¦¤¹¤ë¤³¤È¤Ç¡¢CurrentTick()-t0~
¤¬stop_time¤ËÆþ¤ì¤¿Ãͤλþ´Öʬ¤òͤ¹¤Èwhile¤Îưºî¤òÄä»ß¤·¡¢¼¡¤Îưºî¤Ç¤¢¤ëOff(OUT_BC);Wait(1000);~
¤ò¼Â¹Ô¤·¡¢¥í¥Ü¥Ã¥È¤Ï1Éôֻߤޤ롣¤³¤ì¤¬¥×¥í¥°¥é¥àÃæ¤Ît0=CurrentTick()¤È(CurrentTick()-t0<stop_time~
¤Î°ÕÌ£¹ç¤¤¤È¤Ê¤ë¡£~
¤½¤·¤Æº¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¾ì¹ç if(SENSOR_1<black)¤Èelse if(SENSOR_1<darkgray)¤Ë~
t0=CurrentTick();¤¬Æþ¤Ã¤Æ¤ª¤é¤ºblack¤¹¤Ê¤ï¤Á20¤è¤ê¾®¤µ¤¤ÃÍ¡¢darkgray¤¹¤Ê¤ï¤Á28¤è¤ê¾®¤µ¤¤ÃÍ~
¤ò¸¡ÃΤ·¤¿»þ´Ö¤¬stop_time¤ÎÃͤλþ´Öʬ¤òĶ²á¤·¤¿¾ì¹ç¤Ë¤Ïwhile¤Îưºî¤òÄä»ß¤·¡¢¼¡¤Îưºî¤Ç¤¢¤ëOff(OUT_BC);Wait(1000);~
¤ò¼Â¹Ô¤·¡¢¥í¥Ü¥Ã¥È¤Ï1Éôֻߤޤë
sub followline_L(int stop_time)
{
long t0=CurrentTick();
while(CurrentTick()-t0<stop_time){¡¡//stop_time¤Ë¤¤¤ì¤¿ÃͤòĶ²á¤¹¤ë¤È¼¡¤Î¥×¥í¥°¥é¥à¤Ø
if(SENSOR_1<black){ //black¤¹¤Ê¤ï¤Á20¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤ØÀû²ó
rotate_left;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}else if(SENSOR_1<darkgray){¡¡¡¡//darkgray¤¹¤Ê¤ï¤Á28¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤Ø
turn_left; ¡¡¡¡¡¡ //¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}else if(SENSOR_1>lightdark){¡¡¡¡//lightdray¤¹¤Ê¤ï¤Á40¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤Ø¶Ê¤¬¤ë
turn_right; ¡¡¡¡¡¡ //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else if(SENSOR_1<center){¡¡¡¡¡¡//center¤¹¤Ê¤ï¤Á35¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èľ¿Ê¤¹¤ë
go_straight; ¡¡¡¡¡¡ //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else{¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//white¤¹¤Ê¤ï¤Á50¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤ØÀû²ó
rotate_right; ¡¡¡¡¡¡ //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}
}
Off(OUT_BC);
Wait(1000);
}
***±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¸òº¹ÅÀǧ¼± [#z33fa8be]
±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¾ì¹ç¡¢¡Ö¹õ¡×¤È¡Ö¹õ¤È¶Ìܤδ֡פΡ¤È£¤Îưºî¤¬~
Ϣ³¤Ç²¿Éô֤«Æ°ºî¤·¤¿¤È¤¤Ë¡¢»ß¤Þ¤ë¤è¤¦¤Ë¤¹¤ë¡£~
¤³¤Î¸¶Íý¤Ïº¸Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Î¾ì¹ç¤ÈƱ¤¸¤È¤Ê¤ë¡£
sub followline_R(int stop_time)
{
long t0=CurrentTick();
while(CurrentTick()-t0<stop_time){¡¡//stop_time¤Ë¤¤¤ì¤¿ÃͤòĶ²á¤¹¤ë¤È¼¡¤Î¥×¥í¥°¥é¥à¤Ø
if(SENSOR_1<black){ //black¤¹¤Ê¤ï¤Á20¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤ØÀû²ó
rotate_right; //¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}else if(SENSOR_1<darkgray){¡¡¡¡//darkgray¤¹¤Ê¤ï¤Á28¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤Ø
turn_right; //¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}else if(SENSOR_1>lightdark){¡¡¡¡//lightdray¤¹¤Ê¤ï¤Á40¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤Ø¶Ê¤¬¤ë
turn_left; //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else if(SENSOR_1<center){¡¡¡¡¡¡//center¤¹¤Ê¤ï¤Á35¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èľ¿Ê¤¹¤ë
go_straight; //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else{¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//white¤¹¤Ê¤ï¤Á50¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤ØÀû²ó
rotate_left; //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}
}
Off(OUT_BC);
Wait(1000);
}
Ëô¡¢¥³¡¼¥¹¤ÎÅÓÃæ¤Îk¤«¤éL¤Ë¸þ¤«¤¤¡¢L¤Ç»ß¤Þ¤ë¥×¥í¥°¥é¥ß¥ó¥°¤ò¹Í¤¨¤¿·ë²Ì¡¢~
±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ç¡ÖÇò¡×¤È¡ÖÇò¤Î¶Ìܡפ΢¤È¤¤Îưºî¤òϢ³¤Ç¹Ô¤¦¤È~
»ß¤Þ¤ë¥×¥í¥°¥é¥ß¥ó¥°¤¬´°À®¤·¤¿¡£
¤³¤Î¾ì¹çelse if(SENSOR_1>lightdark) ¤Èelse¤Ë~
t0=CurrentTick();¤¬Æþ¤Ã¤Æ¤ª¤é¤ºlightdray¤¹¤Ê¤ï¤Á40¤è¤êÂ礤¤ÃÍ¡¢white¤¹¤Ê¤ï¤Á50¤è¤êÂ礤¤ÃÍ~
¤ò¸¡ÃΤ·¤¿»þ´Ö¤¬stop_time¤ÎÃͤλþ´Öʬ¤òĶ²á¤·¤¿¾ì¹ç¤Ë¤Ïwhile¤Îưºî¤òÄä»ß¤·¡¢¼¡¤Îưºî¤Ç¤¢¤ëOff(OUT_BC);Wait(1000);~
¤ò¼Â¹Ô¤·¡¢¥í¥Ü¥Ã¥È¤Ï1Éôֻߤޤ롣
#ref(2019a/Member/Gouki/Mission2/Inked2019a-mission23_LI.jpg,70%);
sub followline_R2(int stop_time)
{
long t0=CurrentTick();
while(CurrentTick()-t0<stop_time){¡¡//stop_time¤Ë¤¤¤ì¤¿ÃͤòĶ²á¤¹¤ë¤È¼¡¤Î¥×¥í¥°¥é¥à¤Ø
if(SENSOR_1<black){ //black¤¹¤Ê¤ï¤Á20¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤ØÀû²ó
rotate_right;¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡//¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else if(SENSOR_1<darkgray){¡¡ ¡¡//darkgray¤¹¤Ê¤ï¤Á28¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤Ø
turn_right; //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else if(SENSOR_1>lightdark){¡¡ ¡¡//lightdray¤¹¤Ê¤ï¤Á40¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤Ø¶Ê¤¬¤ë
turn_left; //¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}else if(SENSOR_1<center){¡¡ ¡¡¡¡//center¤¹¤Ê¤ï¤Á35¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èľ¿Ê¤¹¤ë
go_straight2; //¤³¤ÎưºîÃæ¤Ï¥é¥¤¥ó¥È¥ì¡¼¥¹¤·Â³¤±¤ë
t0=CurrentTick();
}else{¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ ¡¡//white¤¹¤Ê¤ï¤Á50¤è¤êÂ礤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤ØÀû²ó
rotate_left; //¤³¤Îưºî¤¬Ï¢Â³¤¹¤ë¤È»ß¤Þ¤ë
}
}
Off(OUT_BC);
Wait(2000);
}
**¸òº¹ÅÀ²£ÃÇ [#z69f3aff]
¸òº¹ÅÀ¤òǧ¼±¤·¤¿¸å¡¢Ä¾¿Ê¡¢º¸ÀÞ¡¢±¦ÀÞ¤ÎÆ°ºî¤ò¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£~
¤½¤³¤Ç»ä¤¿¤Á¤Ï¡¢¤¢¤ëÃͤò¸¡ÃΤ¹¤ë¤Þ¤Ç°ìÄê¤Îưºî¤ò¹Ô¤¤Â³¤±¤ë¥×¥í¥°¥é¥ß¥ó¥°¤òºî¤Ã¤¿¡£
¡ûľ¿Ê~
28¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ·¤Æ¤¤¤ë»þ¤Ïľ¿Ê¤·¡¢~
28¤è¤êÂ礤¤Ãͤò¸¡ÃΤ·¤¿¤é»ß¤Þ¤ë¡£
¢ª¹õ¤¤Àþ¾å¤Ç¤Ïľ¿Ê
sub Blackto_White()
{
while(SENSOR_1<darkgray){¡¡ ¡¡//darkdray¤¹¤Ê¤ï¤Á28¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èľ¿Ê¤¹¤ë
OnFwd(OUT_BC,15);
}
Off(OUT_BC);
}
¡û±¦ÀÞ~
40¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ·¤Æ¤¤¤ë»þ¤Ï±¦ÀÞ¤·¡¢~
40¤è¤êÂ礤¤Ãͤò¸¡ÃΤ·¤¿¤é»ß¤Þ¤ë¡£
¢ª¹õ¤¤Àï¾ì¤Ç¤Ï±¦ÀÞ
sub Blackto_White_R()
{
while(SENSOR_1<lightgray){¡¡ ¡¡//lightdray¤¹¤Ê¤ï¤Á40¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤È±¦¤ØÀû²ó
OnFwd(OUT_C,20);
OnRev(OUT_B,20);
}
Off(OUT_BC);
}
¡ûº¸ÀÞ~
40¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ·¤Æ¤¤¤ë»þ¤Ïº¸ÀÞ¤·¡¢~
40¤è¤êÂ礤¤Ãͤò¸¡ÃΤ·¤¿¤é»ß¤Þ¤ë¡£
¢ª¹õ¤¤Àï¾ì¤Ç¤Ïº¸ÀÞ
sub Blackto_White_L()
{
while(SENSOR_1<lightgray){¡¡ ¡¡//lightdray¤¹¤Ê¤ï¤Á40¤è¤ê¾®¤µ¤¤Ãͤò¸¡ÃΤ¹¤ë¤Èº¸¤ØÀû²ó
OnFwd(OUT_B,20);
OnRev(OUT_C,20);
}
Off(OUT_BC);
}
**¥Ü¡¼¥ë [#m8834b2f]
º£½©¤Î²ÝÂê¤Ç¤Ï¥³¡¼¥¹¤ÎÅÓÃæ¤Ç¥Ü¡¼¥ë¤ò¤Ä¤«¤ß¡¢~
¥Ü¡¼¥ë¤ò±¿¤ó¤Ç¡¢ºÇ¸å¤Ë¥´¡¼¥ë¤·¤Ê¤±¤ì¤Ð¤¤¤±¤Ê¤¤¤Î¤Ç~
¤Ä¤«¤à¤¿¤á¤Î¥×¥í¥°¥é¥à¤È¥´¡¼¥ë¤¹¤ë¤¿¤á¤Î¥×¥í¥°¥é¥à¤òºîÀ®¤¹¤ë¡£
***¥Ü¡¼¥ë¤ò¤È¤ë¤¿¤á¤Î¥×¥í¥°¥é¥à [#e0f200a7]
#define catch OnRev(OUT_A,25);Wait(500);Off(OUT_A);
***¥Ü¡¼¥ë¤òÎ¥¤·¡¢¥´¡¼¥ë¤¹¤ë¤¿¤á¤Î¥×¥í¥°¥é¥à [#da74ff35]
¥´¡¼¥ë¤¹¤ëÊýË¡¤Ï¡¢¥Ü¡¼¥ë¤òÎ¥¤·¤¿ºÝ¤ËËÜÂΤǥ³¥Ä¥ó¤È²¡¤·½Ð¤¹¤È¤¤¤¦¤â¤Î¤À¡£~
¤½¤Î¤¿¤áºÇ¸å¤Îưºî¤Î½ÐÎϤÏÂçÉý¤Ë¾å¤²¤Æ¤¢¤ë¡£~
#define release OnFwd(OUT_A,25);Wait(500);Off(OUT_A);
#define osidasi OnFwd(OUT_BC,100);Wait(100);Off(OUT_BC);
***¥Ü¡¼¥ë¤ò¤È¤Ã¤¿¸å [#uc47bf2f]
¥Ü¡¼¥ë¤ò¤È¤Ã¤¿¤é¤¢¤ëÄøÅÙº¸¤ËÀû²ó¤µ¤»¡¢±¦Â¦¤Î¥é¥¤¥ó¥È¥ì¡¼¥¹¤Ë¤Ä¤Ê¤²¤ë¤è¤¦¤Ë¤¹¤ë¡£
#define turn OnFwd(OUT_B,25);OnRev(OUT_C,25);Wait(1500);Off(OUT_BC);
*¥³¡¼¥¹¤òư¤¯Î®¤ì [#f050659c]
ºÇ½ªÅª¤Ë¤Ï²¼µ¤Î¤è¤¦¤Êή¤ì¤Çưºî¤ò¹Ô¤¦¡£
#ref(2019a/Member/Gouki/Mission2/Inked2019a-mission234_LI.jpg,70%);
task main()
{
SetSensorLight(S1);
followline_L(200);¡¡¡¡¡¡//1
Blackto_White(); //2
followline_L(150); //3
Blackto_White_R(); //4
followline_R(200); //5
Blackto_White_R(); //6
followline(150); //7
Blackto_White_R(); //8
followline(150); //9
Blackto_White_R(); //10
followline(150); //11
Blackto_White(); //12
followline_R2(200); //13
catch; //¥Ü¡¼¥ë¤ò¤Ä¤«¤à
turn; //º¸¤ËÀû²ó¤¹¤ë
followline_R(150); //14
Blackto_White(); //15
followline_R(150); //16
Blackto_White_L(); //17
followline_R(150); //18
release; //¥Ü¡¼¥ë¤òÎ¥¤¹
osidasi; //¥´¡¼¥ë¤¹¤ë
}
*Á´ÂÎ¤Î¥×¥í¥°¥é¥à [#t0578dcf]
#define turn_right OnFwd(OUT_C,25);OnRev(OUT_B,15);
#define turn_left OnFwd(OUT_B,25);OnRev(OUT_C,15);
#define rotate_right OnFwd(OUT_C,20);OnRev(OUT_B,20);
#define rotate_left OnFwd(OUT_B,20);OnRev(OUT_C,20);
#define go_straight OnFwd(OUT_BC,20);
#define go_straight2 OnFwd(OUT_BC,15);
#define turn OnFwd(OUT_B,25);OnRev(OUT_C,25);Wait(1500);Off(OUT_BC);
#define catch OnRev(OUT_A,25);Wait(500);Off(OUT_A);
#define release OnFwd(OUT_A,25);Wait(500);Off(OUT_A);
#define osidasi OnFwd(OUT_BC,100);Wait(100);Off(OUT_BC);
#define black 20
#define white 50
#define lightgray 40
#define darkgray 28
#define center 35
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>lightdark){
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>lightdark){
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>lightdark){
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<darkgray){
OnFwd(OUT_BC,15);
}
Off(OUT_BC);
}
sub Blackto_White_R()
{
while(SENSOR_1<lightgray){
OnFwd(OUT_C,20);
OnRev(OUT_B,20);
}
Off(OUT_BC);
}
sub Blackto_White_L()
{
while(SENSOR_1<lightgray){
OnFwd(OUT_B,20);
OnRev(OUT_C,20);
}
Off(OUT_BC);
}
task main()
{
SetSensorLight(S1);
followline_L(200);
Blackto_White();
followline_L(150);
Blackto_White_R();
followline_R(200);
Blackto_White_R();
followline(150);
Blackto_White_R();
followline(150);
Blackto_White_R();
followline(150);
Blackto_White();
followline_R2(200);
catch;
turn;
followline_R(150);
Blackto_White();
followline_R(150);
Blackto_White_L();
followline_R(150);
release;
osidasi;
}
*¤Þ¤È¤á [#y2be8016]
º£²ó¤Î²ÝÂê¤Ç¤Ï¡¢¥ß¥¹¤ò¤»¤º¤¤Á¤ó¤È´°Áö¤µ¤»¡¢¥´¡¼¥ë¤¹¤ë¤³¤È¤¬½ÐÍ褿¡£~
¥í¥Ü¥Ã¥È¤Îµ¡ÂΤȤ·¤Æ¤Î½ÐÍè¤â¤è¤¯¤¤Á¤ó¤ÈÁö¤Ã¤Æ¤¯¤ì¤¿¤¬¡¢½ê¡¹ÅÅÃӤΤ»¤¤¤Ê¤Î¤«~
ư¤¤¬Æß¤¯¤Ê¤ë»þ¤¬¤¢¤Ã¤¿¡£
·ë²Ì¤À¤±¤ò¸«¤ë¤ÈÎɤ«¤Ã¤¿¤â¤Î¤Î¡¢¤Þ¤À¥×¥í¥°¥é¥ß¥ó¥°¤Ë¤«¤±¤ë»þ´Ö¤¬Ä¹¤¯~
;·×¤Ê¥×¥í¥°¥é¥à¤â¤¢¤ë¡£
º£¡¹¹Í¤¨¤Æ¤ß¤ë¤È¡¢ÅÓÃæ¤Îº¸Àû²ó¤Ï¤¤¤é¤Ê¤¯¤Æ¡¢¤½¤Î¤Þ¤Þ¥é¥¤¥ó¥È¥ì¡¼¥¹~
¤µ¤»¤ì¤Ð¥×¥í¥°¥é¥à¤¬¤â¤Ã¤Èû¤¯¤Ê¤ë¤È»×¤Ã¤¿¡£~
¤Þ¤À¤Þ¤À¡¢¥×¥í¥°¥é¥à¤ÎÌ̤Ç;·×¤Ê¤È¤³¤í¤¬¤¢¤ë¤È»×¤¦¤Î¤Ç¡¢~
¼¡¤Î²ÝÂê¤Ç¤Ï¤½¤Î¤è¤¦¤Ê¥ß¥¹¤ò¸º¤é¤·¤Æ¡¢´Ê·é¤Ç¤è¤ê¤è¤¤¥×¥í¥°¥é¥à¤Ë~
»Å¾å¤²¤é¤ì¤ë¤è¤¦¤Ë¤·¤¿¤¤¤È»×¤¦¡£
¥Ú¡¼¥¸Ì¾: