2004/C4/練習問題51

#define Do 523
#define Re 587
#define Mi 659
#define Fa 698
#define Son 784
#define Ra 880
#define Shi 988
#define Don 1047
#define Ren 1175
#define Min 1319
#define Shim 932
task play_music1()//musunnde hiraite
{
  while(true)
  {  //うさぎ
PlayTone(Fa,60);Wait(65);
PlayTone(Fa,30);Wait(35);
PlayTone(Ra,30);Wait(35);
PlayTone(Shi,30);Wait(35);
PlayTone(Ra,30);Wait(35);
PlayTone(Shi,30);Wait(65);
PlayTone(Fa,30);Wait(35);
PlayTone(Fa,30);Wait(35);  
PlayTone(Fa,30);Wait(35); 
PlayTone(Ra,30);Wait(35);
PlayTone(Shi,30);Wait(35);
PlayTone(Ra,30);Wait(35);
PlayTone(Shi,30);Wait(65); 
PlayTone(Ra,30);Wait(35);
PlayTone(Shi,30);Wait(35);
PlayTone(Don,30);Wait(35);
PlayTone(Don,30);Wait(35);
PlayTone(Shi,30);Wait(35);
PlayTone(Ra,15);Wait(20);
PlayTone(Ra,15);Wait(20);
PlayTone(Fa,30);Wait(35);
PlayTone(Mi,30);Wait(35);  
PlayTone(Ra,30);Wait(35); 
PlayTone(Fa,30);Wait(35);
PlayTone(Mi,60);Wait(65);
PlayTone(Fa,30);Wait(35);
PlayTone(Mi,30);Wait(35); 
PlayTone(Re,60);Wait(65);
PlayTone(Mi,60);Wait(65);
/* PlayTone(Mi,60);Wait(65); 
PlayTone(Ra,60);Wait(65);
PlayTone(Ra,60);Wait(65);
PlayTone(Ra,60);Wait(65); 
PlayTone(Shim,60);Wait(65);
PlayTone(Don,60);Wait(65);
PlayTone(Don,60);Wait(65); 
PlayTone(Ren,60);Wait(65);
PlayTone(Ren,60);Wait(65);
PlayTone(Don,120);Wait(125); */
Wait(20);
 }
}
task play_music2()//spring is comming
{
  while(true)
  {   //春が来た
 PlayTone(Son,20);Wait(25);
 PlayTone(Mi,10);Wait(15);
 PlayTone(Fa,10);Wait(15);
 PlayTone(Son,20);Wait(25);
 PlayTone(Ra,20);Wait(25);
 PlayTone(Son,20);Wait(25);
 PlayTone(Mi,10);Wait(15);
 PlayTone(Fa,10);Wait(15);  
 PlayTone(Son,20);Wait(25); 
 PlayTone(Don,20);Wait(25);
 PlayTone(Ra,20);Wait(25);
 PlayTone(Son,20);Wait(25);
 PlayTone(Mi,40);Wait(45); 
 PlayTone(Do,10);Wait(25);
 PlayTone(Re,60);Wait(65);
 PlayTone(Son,20);Wait(25);
 PlayTone(Ra,10);Wait(15);
 PlayTone(Son,10);Wait(15);
 PlayTone(Mi,20);Wait(25);
 PlayTone(Son,20);Wait(25);
 PlayTone(Don,20);Wait(25);
 PlayTone(Ren,10);Wait(15);  
 PlayTone(Don,10);Wait(15); 
 PlayTone(Ra,20);Wait(25);
 PlayTone(Don,20);Wait(25);
 PlayTone(Son,20);Wait(25);
 PlayTone(Min,20);Wait(25); 
 PlayTone(Ren,40);Wait(45);
 PlayTone(Son,10);Wait(15);
 PlayTone(Don,60);Wait(65);
 Wait(20);
 }
}
task main()
{
  SetSensor(SENSOR_1,SENSOR_TOUCH);
  SetSensor(SENSOR_3,SENSOR_TOUCH);
 
  while(true){ 
  start play_music2; //直進しながら演奏
  OnFwd(OUT_A+OUT_C);
  until(SENSOR_1==1);
  stop play_music2; 
  start play_music1;  //後退しながら演奏
  OnRev(OUT_A+OUT_C);
  until(SENSOR_3==1);
  stop play_music1;
   }
}

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2004-12-17 (金) 19:32:19 (5360d)