My First attempt at a sketch

Its a collaboration i put together to make a Lcd xmas card
while trying to figure out more coding.
i like to learn threw trial and error.

ill post a vid tonight when i get home.

//LCD Christmas Card
//Made using Tone Library, And SerLCD Library.
//Uses Serial Lcd on Pin 1, And small Speaker on pin 12.

#include <Tone.h>

Tone tone1;

#define OCTAVE_OFFSET 0

int notes[] = { 0,
NOTE_C4, NOTE_CS4, NOTE_D4, NOTE_DS4, NOTE_E4, NOTE_F4, NOTE_FS4, NOTE_G4, NOTE_GS4, NOTE_A4, NOTE_AS4, NOTE_B4,
NOTE_C5, NOTE_CS5, NOTE_D5, NOTE_DS5, NOTE_E5, NOTE_F5, NOTE_FS5, NOTE_G5, NOTE_GS5, NOTE_A5, NOTE_AS5, NOTE_B5,
NOTE_C6, NOTE_CS6, NOTE_D6, NOTE_DS6, NOTE_E6, NOTE_F6, NOTE_FS6, NOTE_G6, NOTE_GS6, NOTE_A6, NOTE_AS6, NOTE_B6,
NOTE_C7, NOTE_CS7, NOTE_D7, NOTE_DS7, NOTE_E7, NOTE_F7, NOTE_FS7, NOTE_G7, NOTE_GS7, NOTE_A7, NOTE_AS7, NOTE_B7};

char *song = "WeWishYou:d=4,o=5,b=200:d,g,8g,8a,8g,8f#,e,e,e,a,8a,8b,8a,8g,f#,d,d,b,8b,8c6,8b,8a,g,e,d,e,a,f#,2g,d,g,8g,8a,8g,8f#,e,e,e,a,8a,8b,8a,8g,f#,d,d,b,8b,8c6,8b,8a,g,e,d,e,a,f#,1g,d,g,g,g,2f#,f#,g,f#,e,2d,a,b,8a,8a,8g,8g,d6,d,d,e,a,f#,2g,d,g,8g,8a,8g,8f#,e,e,e,a,8a,8b,8a,8g,f#,d,d,b,8b,8c6,8b,8a,g,e,d,e,a,f#,2g";

void setup(void)
{
  Serial.begin(9600);
  tone1.begin(12);
 
  Serial.begin(9600);
  StartupMessage();
 
}
void StartupMessage()
{
  clearLCD();
  delay(1000);
  selectLineOne();
  Serial.print(" Money Is Short");
  delay(1000);
  
  selectLineTwo();
  Serial.print("And Times R Hard");
  delay(2000);
   
  clearLCD();
  delay(1000);
  
  selectLineOne();
  Serial.print("So Heres Ur Gift");
  delay(1000);
  
  selectLineTwo();
  Serial.print("A Christmas Card");
  delay(2000);
  clearLCD();
  delay(1000);
  
  selectLineOne();
  Serial.print("  Yours Truely");
  delay(1000);
  
  selectLineTwo();
  Serial.print("    Sam");
  delay(2000);
  clearLCD();
  delay(2000);

  selectLineOne();
  Serial.print("     Merry");
    
  selectLineTwo();
  Serial.print("   Christmas!");
}
void selectLineOne(){
  Serial.print(0xFE, BYTE);  
  Serial.print(128, BYTE);   
}
void selectLineTwo(){
  Serial.print(0xFE, BYTE);  
  Serial.print(192, BYTE);   
}
void goTo(int position) { 
if (position<16){ Serial.print(0xFE, BYTE);   
  Serial.print((position+128), BYTE);    
}else if (position<32){Serial.print(0xFE, BYTE);   
  Serial.print((position+48+128), BYTE);   
} else { goTo(0); }
}

void clearLCD(){
  Serial.print(0xFE, BYTE);  
  Serial.print(0x01, BYTE);  
}
void backlightOn(){  
  Serial.print(0x7C, BYTE);   
  Serial.print(157, BYTE);    
}
void backlightOff(){  
  Serial.print(0x7C, BYTE);   
  Serial.print(128, BYTE);    
}
void serCommand(){   
  Serial.print(0xFE, BYTE);
}

#define isdigit(n) (n >= '0' && n <= '9')

void play_rtttl(char *p)
{
  byte default_dur = 4;
  byte default_oct = 6;
  int bpm = 63;
  int num;
  long wholenote;
  long duration;
  byte note;
  byte scale;
  while(*p != ':') p++;    
  p++;                    
  if(*p == 'd')
  {
  p++; p++; 
  num = 0;
  while(isdigit(*p))
  {
  num = (num * 10) + (*p++ - '0');
  }
  if(num > 0) default_dur = num;
  p++; 
  }
  if(*p == 'o')
  {
  p++; p++; 
  num = *p++ - '0';
  if(num >= 3 && num <=7) default_oct = num;
  p++;      
  }
  if(*p == 'b')
  {
  p++; p++; 
  num = 0;
  while(isdigit(*p))
  {
  num = (num * 10) + (*p++ - '0');
  }
  bpm = num;
  p++;
  }
  wholenote = (60 * 1000L / bpm) * 4;  
  while(*p)
  {
  num = 0;
  while(isdigit(*p))
  {
  num = (num * 10) + (*p++ - '0');
  }
  if(num) duration = wholenote / num;
  else duration = wholenote / default_dur;  
  note = 0;
  switch(*p)
  {
  case 'c':
  note = 1;
  break;
  case 'd':
  note = 3;
  break;
  case 'e':
  note = 5;
  break;
  case 'f':
  note = 6;
  break;
  case 'g':
  note = 8;
  break;
  case 'a':
  note = 10;
  break;
  case 'b':
  note = 12;
  break;
  case 'p':
  default:
  note = 0;
  }
  p++;
  if(*p == '#')
  {
  note++;
  p++;
  }
  if(*p == '.')
  {
  duration += duration/2;
  p++;
  }
  if(isdigit(*p))
  {
  scale = *p - '0';
  p++;
  }
  else
  {
  scale = default_oct;
  }
  scale += OCTAVE_OFFSET;
  if(*p == ',')
  p++; 
  if(note)
  {
  tone1.play(notes[(scale - 4) * 12 + note]);
  delay(duration);
  tone1.stop();
  }
  else
  {
  delay(duration);
  }
  }
}

void loop(void)
{
  play_rtttl(song);
  while(1);
  
}