[[2004/A5]]

task wall修正版

task wall()
{
 while(true)
 {
  if(SENSOR_3 == 1)
  {
   stop search;stop check_sensors;stop comeback;
   PlaySound(4);Wait(50); 
   OnRev(OUT_A);Off(OUT_C);Wait(120);
   start search;
  }
 }
}

taskwall改

task wall()
{
 while(true)
 {
  if(SENSOR_3 == 1)
  {
   stop search;stop check_sensors;stop comeback;stop line;
   PlaySound(4);Wait(50); 
   OnRev(OUT_A);Off(OUT_C);Wait(120);
   start search;
  }
 }
} 

task comeback改

task comeback()
{
 ClearMessage();
 ClearTimer(0);
 SendMessage();
 do
 { 
 stop search;
 start line;
 until(Message() != 0); 
 if(Message() == ){stop line;PlaySound(1);Wait(100);SendMessage();Wait(100);}
 if(Message() == ){PlaySound(5);Wait(100);forwards(1000);}
 if(Message() == ){backwards(200);turn_left(120);}
 Off(OUT_A+OUT_C);
 } 
 until  (Timer(0) < 200);
 stop line;
 turn_left(50);
 start search;
}

注:ロボ3にバンパーとメッセージの追加が必要

task line

task line()
{
 while(true)
 {
  if(SENSOR_2 > 35)
  {
   OnFwd(OUT_C);Off(OUT_A);
  }
  else
  {
   OnFwd(OUT_A);Off(OUT_C);
  }
 }
}



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