***[[学習ノート Hypodytes rubripinnis>2005/A5/学習ノート Hypodytes rubripinnis]] [#a6156c61]
***課題3:光を追いかけるプログラム[[課題4右>2005/A5/課題4右]] [#s5521fcd]

*&color(red){現在製作中!しばしお待ちを!!}; [#r655128e]

*光を追いかけるプログラム [#ndcb6561]
*光を追いかけるプログラム                               &size(30){&color(red){'''movie'''''↓''};}; [#u005afe1]

 作成者:Hypodytes rubripinnis
 最終更新日:12/11

 #define go_straight OnFwd(OUT_A+OUT_C);
 #define turn_right OnFwd(OUT_A);OnRev(OUT_C);
 #define turn_left OnFwd(OUT_C);OnRev(OUT_A);
 
 int max;
 int time;
 
 task main()
 {
     SetSensor(SENSOR_2,SENSOR_LIGHT);
     max=SENSOR_2;
     time=Timer(0);
 
     ClearTimer(0);
 
     while(Timer(0)<=14)
     {
         turn_right
         if(SENSOR_2>max)
           {
            ClearTimer(1);
            max=SENSOR_2 ;
           }
         else
           {
            max=max;
            time=Timer(1);
           }
    }
 
    ClearTimer(1);
 
    while(Timer(1)<=time)
    {turn_left}
 
    while(true)
    {
         if(SENSOR_2>=max-15)
           {go_straight}
         if(SENSOR_2<max-15)
           {
            turn_right
            ClearTimer(2);
            until((SENSOR_2>=max-15)||(Timer(2)==5));
           }
         if(SENSOR_2<max-15)
           {
            turn_left
            until(SENSOR_2>=max-15);
           }
    }
 }

''仕組み&工夫したところ''

&size(30){☆[[動画1:http://yakushi.shinshu-u.ac.jp/robotics/?plugin=attach&pcmd=open&file=robo5.wmv&refer=2005%2FA5%2F%B3%D8%BD%AC%A5%CE%A1%BC%A5%C8%20Hypodytes%20rubripinnis%2F%B8%F7%A4%F2%C4%C9%A4%A4%A4%AB%A4%B1%A4%EB%A5%ED%A5%DC%A5%C3%A5%C8]]};

&size(30){☆[[動画2:http://yakushi.shinshu-u.ac.jp/robotics/?plugin=attach&pcmd=open&file=robo5-2.wmv&refer=2005%2FA5%2F%B3%D8%BD%AC%A5%CE%A1%BC%A5%C8%20Hypodytes%20rubripinnis%2F%B8%F7%A4%F2%C4%C9%A4%A4%A4%AB%A4%B1%A4%EB%A5%ED%A5%DC%A5%C3%A5%C8]]};

&ref(2005/A5/学習ノート Hypodytes rubripinnis/光を追いかけるロボット/robo5-2.JPG,30%);
&ref(2005/A5/学習ノート Hypodytes rubripinnis/光を追いかけるロボット/robo5.JPG,30%);

#comment


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS