Arduinoで作るCW練習機

スケッチ

戻る

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4); 

void setup(){
  Serial.begin(9600);

  pinMode(4, INPUT_PULLUP);
  pinMode(16, INPUT);

  lcd.init();
  lcd.backlight();

  delay(6000); //スイッチONの6秒後に開始
}

int i =0;
int mojikan =2500;
int fugokan_tan =300;
int fugokan_cho =600;
int tanten =250;
int choten =500;

int j=100;
int randomNumber;

float speedLevel;

void loop() {
 speedLevel =analogRead(16);

 float s=speedLevel/1500+0.2;
  
  if (i<80){
    if(i==20){
     lcd.setCursor(0,1);
    }
    if(i==40){
     lcd.setCursor(0,2);
    }
    if(i==60){
     lcd.setCursor(0,3);
    }
  if(randomNumber != j){
    if(digitalRead(4)==LOW){     
     randomSeed(analogRead(0));  // A0ピンのノイズを利用
     randomNumber = random(36); // 0から35の乱数を生成
    }
  } 
  else if(randomNumber == j){

  if(digitalRead(4)==LOW){     
     randomSeed(analogRead(0));  // A0ピンのノイズを利用
     randomNumber = random(36); // 0から35の乱数を生成
    }
  }

    Serial.print("randomNumber->");
    Serial.print(randomNumber);
    Serial.print("j->");
    Serial.println(j);


  if(digitalRead(4)==LOW){ 

    if(randomNumber == 0){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("A");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 1){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("B");
      delay(mojikan*s);
      i=i+1;     
     }
     else if (randomNumber == 2){
     j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("C");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 3){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("D");
      delay(mojikan*s);
      i=i+1;
      
     }
     else if (randomNumber == 4){
      j = randomNumber;
      tone(2,400,tanten*s);
      lcd.print("E");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 5){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("F");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 6){
      j = randomNumber;
      tone(2,400,550*s);
      delay(fugokan_cho*s);
      tone(2,400,550*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("G");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 7){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("H");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 8){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("I");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 9){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("J");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 10){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("K");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 11){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("L");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 12){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("M");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 13){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("N");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 14){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("O");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 15){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("P");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 16){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("Q");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 17){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("R");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 18){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("S");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 19){
      j = randomNumber;
      tone(2,400,choten*s);
      lcd.print("T");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 20){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("U");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 21){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("V");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 22){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s); 
      tone(2,400,choten*s);
      lcd.print("W");  
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 23){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("X");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 24){
      j = randomNumber; 
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("Y");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 25){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("Z");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 26){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("1");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 27){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("2");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 28){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("3");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 29){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("4");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 30){
      j = randomNumber;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("5");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 31){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("6");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 32){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("7");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 33){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("8");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 34){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("9");
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 35){
      j = randomNumber;
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("0");
      delay(mojikan*s);
      i=i+1;
      }
    }
    else if(digitalRead(4)==HIGH){

    randomSeed(analogRead(0));  // A0ピンのノイズを利用
    randomNumber = random(71); // 0から70の乱数を生成{

    if (randomNumber == 0){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xb1");  //ア
      delay(mojikan*s);

      i=i+1;
     }
     else if (randomNumber == 1){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xb2");  //イ
      delay(mojikan*s);
      i=i+1;;
     }
     else if (randomNumber == 2){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xb3");  //ウ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 3){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xb4");  //エ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 4){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xb5");  //オ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 5){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xb6");  //カ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 6){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xb7");  //キ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 7){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xb8");  //ク
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 8){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xb9");  //ケ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 9){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xba");  //コ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 10){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xbb");  //サ
      delay(mojikan*s);      
      i=i+1;
     }
     else if (randomNumber == 11){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xbc");  //シ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 12){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xbd");  //ス
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 13){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xbe");  //セ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 14){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xbf");  //ソ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 15){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xc0");  //タ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 16){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xc1");  //チ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 17){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xc2");  //ツ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 18){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xc3");  //テ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 19){;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);   
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);   
      tone(2,400,tanten*s);
      lcd.print("\xc4");  //ト
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 20){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xc5");  //ナ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 21){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xc6");  //ニ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 22){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xc7");  //ヌ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 23){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xc8");  //ネ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 24){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xc9");  //ノ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 25){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xca");  //ハ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 26){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xcb");  //ヒ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 27){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xcc");  //フ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 28){
      tone(2,400,tanten*s);
      lcd.print("\xcd");  //ヘ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 29){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xce");  //ホ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 30){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xcf");  //マ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 31){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);  
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xd0"); //ミ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 32){
      tone(2,400,choten*s);
      lcd.print("\xd1");  //ム
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 33){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xd2");  //メ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 34){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xd3");  //モ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 35){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xd4");  //ヤ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 36){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xd5");    //ユ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 37){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xd6");    //ヨ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 38){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xd7");  //ラ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 39){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xd8");  //リ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 40){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xd9");  //ル
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 41){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xda");  //レ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 42){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xdb");  //ロ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 43){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xca");  //ワ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 44){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xa6");  //ヲ
      delay(mojikan*s);
      i=i+1;
     }
     else if (randomNumber == 45){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xdd");  //ン
      delay(mojikan*s);    
      i=i+1;
     }
    if((i<19)&&(i<39)&&(i<59)){
     if (randomNumber == 46){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xb6");  //カ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 47){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xb7");  //キ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 48){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xb8");  //ク
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 49){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xb9");  //ケ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 50){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xba");  //コ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 51){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xbb");  //サ
      delay(mojikan*s);      
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 52){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xbc");  //シ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 53){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xbd");  //ス
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 54){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xbe");  //セ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 55){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xbf");  //ソ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 56){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xc0");  //タ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
      else if (randomNumber == 57){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xc1");  //チ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 59){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xc2");  //ツ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 60){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      lcd.print("\xc3");  //テ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 61){
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);   
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);   
      tone(2,400,tanten*s);
      lcd.print("\xc4");  //ト
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 62){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xca");  //ハ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 63){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xca");  //ハ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xdf");  //°
      delay(mojikan*s);     
      i=i+1;
     }
     else if (randomNumber == 64){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xcb");  //ヒ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 65){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      lcd.print("\xcb");  //ヒ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xdf");  //°
      delay(mojikan*s);     
      i=i+1;
     }
     else if (randomNumber == 66){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xcc");  //フ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 67){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xcc");  //フ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xdf");  //°
      delay(mojikan*s);     
      i=i+1;
     }
     else if (randomNumber == 68){
      tone(2,400,tanten*s);
      lcd.print("\xcd");  //ヘ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 69){
      tone(2,400,tanten*s);
      lcd.print("\xcd");  //ヘ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xdf");  //°
      delay(mojikan*s);     
      i=i+1;
     }
     else if (randomNumber == 70){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xce");  //ホ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xde");  //゛
      delay(mojikan*s);    
      i=i+1;
     }
     else if (randomNumber == 71){
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      lcd.print("\xce");  //ホ
      delay(mojikan*s);
      i=i+1;
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,tanten*s);
      delay(fugokan_tan*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,choten*s);
      delay(fugokan_cho*s);
      tone(2,400,tanten*s);
      lcd.print("\xdf");  //°
      delay(mojikan*s);     
      i=i+1;
  } }
  } 
  } 
     
}  
タイトルとURLをコピーしました