timor2542

Srisawatwittayakarn March School v1

Aug 12th, 2017
176
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* --- SRISAWATWITTAYAKARN MARCH SCHOOL --- */
  2. /* --- Created by Krittamet Thawong --- */
  3. /* --- Credit: Teacher Piya Kanatham --- */
  4. /* --- Published on 2017/08/02 --- */
  5. #include <ipst.h>   // include for IPST-SE Board
  6. #define time1 350 // Eighth Note
  7. #define time2 600 // Quarter Note
  8. #define time3 1200 // Half Note
  9. #define time4 1600 // Whole Note
  10. int Round=0; //
  11. void setup() {
  12.   glcdClear(); // Clear Screen
  13.   setTextSize(11); // 11x Text Size
  14.   setTextColor(GLCD_RED); // Red Text
  15.   glcd(0,0,"S");
  16.   setTextColor(GLCD_YELLOW); // Yellow Text
  17.   glcd(0,1,"W");
  18.   setTextSize(3); // 3x Text Size
  19.   setTextColor(GLCD_ORANGE);// Orange Text
  20.   glcd(3,1,"March");
  21. }
  22.  
  23. void loop() {
  24.   setTextSize(2); // 2x Text Size
  25.   int state=0;
  26.   setTextColor(GLCD_DOLLAR);
  27.   glcd(6,1,"Press");
  28.   glcd(7,2,"to play");
  29.   setTextColor(GLCD_YELLOW);
  30.   while(sw_OK()==0) // unless press OK
  31.   {
  32.     if (state==0)
  33.     {
  34.       glcd(6,7,"OK.");
  35.     }
  36.     else
  37.     {
  38.       glcd(6,7,"  ");
  39.     }
  40.   delay(150);
  41.   state=state^0x01;
  42.   }
  43.   setTextColor(GLCD_GREEN);
  44.   glcd(6,1," Playing ");
  45.   glcd(7,2,"       ");
  46.   setTextColor(GLCD_WHITE);
  47.   Round=0;
  48. for(Round=0;Round<3;Round++) // 3 Rounds of Playing SW March.
  49. {
  50.  for(int i=0;i<2;i++) //"SRISAWAT" 2 Rounds
  51.  {
  52.  sound(E_5,time1); //SRI
  53.  sound(F_5,time1); //SA
  54.  sound(G_5,time2); //WAT
  55.  delay(100);
  56.  sound(C_5,time1); //SRI
  57.  sound(C_5,time1); //SA
  58.  sound(C_5,time1); //WAT
  59.  delay(250);
  60.  }
  61.  delay(100);
  62.  sound(C_5,time1); //JONG
  63.  sound(D_5,time1); //RENG
  64.  sound(E_5,time1); //RAT
  65.  delay(250);
  66.  sound(E_5,time2); //TANG
  67.  sound(F_5,time2); //JAI
  68.  sound(G_5,time2); //WAI
  69.  sound(D_5,time3); //LAI
  70.  delay(250);
  71.  sound(B_4,time1); //MAI
  72.  sound(C_5,time1); //TONG
  73.  sound(D_5,time1); //KHRAM
  74.  sound(E_5,time1); //KRENG
  75.  sound(D_5,time1); //KHAM
  76.  sound(C_5,time1); //PHU
  77.  sound(B_4,time1); //DAI
  78.  delay(250);
  79.  sound(B_4,time1); //PHA
  80.  sound(C_5,time1); //YA
  81.  sound(D_5,time1); //YAM
  82.  sound(E_5,time1); //BAK
  83.  sound(D_5,time1); //BAN
  84.  sound(C_5,time1); //KHAO
  85.  sound(B_4,time1); //PAI
  86.  delay(250);
  87.  sound(G_5,time1); //REW
  88.  sound(G_5,time1); //KHAO
  89.  sound(G_5,time2); //WAI
  90.  sound(F_5,time2); //NAM
  91.  sound(E_5,time2); //CHAI
  92.  sound(D_5,time2); //MA
  93.  sound(D_5,time2); //HAI
  94.  if(Round==2)
  95.  {
  96.    sound(C_5,time3);//RAO(C)
  97.  }
  98.  else{
  99.    sound(E_5,time3);//RAO(E)
  100.  }
  101.  delay(time1);
  102.   }
  103.  setTextColor(GLCD_SKY);
  104.  glcd(6,0,"Thank you!");
  105.  delay(3000);
  106.  glcd(6,0,"          ");
  107. }
RAW Paste Data