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

''アクセス数:今日&counter(today); 総数&counter(all);''
''アクセス数:今日&counter(today); 総数&counter(all);   最終更新日:&lastmod;''

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

*光を追いかけるプログラム『センサー2個ver.』                  &size(30){&color(red){'''movie'''''↓''};}; [#w0f52751]

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

 #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);
 #define minous 25
 
 int max;
 int time;
 task main()
 {
     SetSensor(SENSOR_1,SENSOR_LIGHT);
     SetSensor(SENSOR_3,SENSOR_LIGHT);
     max=SENSOR_1;
     time=Timer(0);
 
     ClearTimer(0);
 
     while(Timer(0)<=14)
     {
         turn_right
         if(SENSOR_1>max)
           {
            ClearTimer(1);
            max=SENSOR_1;
           }
         else
           {
            max=max;
            time=Timer(1);
           }
    }
 
    ClearTimer(1);
 
    while(Timer(1)<=time)
    {turn_left}
 
    while(true)
    {
         if((SENSOR_1>=max-minous)==(SENSOR_3>=max-minous))
           {go_straight}
         if((max-minous)>SENSOR_3)
           {
            turn_left;Wait(10);
           }
         if(SENSOR_1<(max-minous))
           {
            turn_right;Wait(10);
           }
    }
 }

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

&ref(2005/A5/学習ノート Hypodytes rubripinnis/光を追いかけるロボット『センサー2個ver.』/robo6.JPG,30%);
&ref(2005/A5/学習ノート Hypodytes rubripinnis/光を追いかけるロボット『センサー2個ver.』/robo6-2.JPG,30%);


#comment


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