2004/C7/演奏ロボット(必須)

担当:宮川

#define Ra  440
#define Do  523
#define Dos 554
#define Re  587
#define Res 622
#define Mi  659
#define Fa  698
#define So  784
#define Sos 831
#define hRa 880
#define hDo 1047
#define Wait_Time 60
task play_startsound()
{
         PlayTone(Ra,25) ;  Wait(Wait_Time);   // 1.0 秒待つ
  PlayTone(Ra,25) ;  Wait(Wait_Time);   // 1.0 秒待つ
  PlayTone(Ra,25) ;  Wait(Wait_Time);   // 1.0 秒待つ
  PlayTone(hRa,100) ;  Wait(Wait_Time);   // 1.0 秒待つ
}
task play_sound()
{
   while(true)
   {   
  
  PlayTone(Do,50) ;  Wait(Wait_Time);
  PlayTone(Do,25) ;  Wait(Wait_Time);
  PlayTone(Res,25) ;  Wait(Wait_Time);
  PlayTone(Do,25) ;  Wait(Wait_Time); 
  
  PlayTone(Do,25) ;  Wait(Wait_Time);
  PlayTone(Dos,25) ;  Wait(Wait_Time);
  PlayTone(Res,50) ;  Wait(Wait_Time);
  PlayTone(Res,25) ;  Wait(Wait_Time);
  PlayTone(Dos,25) ;  Wait(Wait_Time);
  PlayTone(Res,25) ;  Wait(Wait_Time);
  PlayTone(Fa,50) ;  Wait(Wait_Time);
  
  PlayTone(Fa,25) ;  Wait(Wait_Time);
  PlayTone(So,25) ;  Wait(Wait_Time);
  PlayTone(Res,25) ;  Wait(Wait_Time);
  PlayTone(Res,50) ;  Wait(Wait_Time);
  
  PlayTone(Res,25) ;  Wait(Wait_Time);
  PlayTone(Do,25) ;  Wait(Wait_Time);
  PlayTone(Res,25) ;  Wait(Wait_Time);
  PlayTone(Sos,50) ;  Wait(Wait_Time);
  
  PlayTone(Fa,25) ;  Wait(Wait_Time);
  PlayTone(So,25) ;  Wait(Wait_Time);
  PlayTone(Res,25) ;  Wait(Wait_Time);
  PlayTone(Res,50) ;  Wait(Wait_Time);
  
  PlayTone(Do,25) ;  Wait(Wait_Time);
  PlayTone(Dos,25) ;  Wait(Wait_Time);
  PlayTone(Do,50) ;  Wait(Wait_Time);
    }   
}
task main()
{
   start play_startsound;
   wait(400);
   stop play_startsound;
   
   start play_sound;
   OnFwd(OUT_A);     //  A 出力に接続されたモータを正回転させる
   Wait(1000);        //  プログラムの実行を3秒待つ (単位は1/100秒)
                     //  この間 A と C のモータは回転したまま (現状維持)
   Off(OUT_A+OUT_C); //  A と C 出力のモータを止める
   OnRev(OUT_A);
   Wait(1000);
   Off(OUT_A+OUT_C);
   stop play_sound;
}

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2005-01-28 (金) 19:32:25