Simple Mores code generator

First time posting on Exhibition. I’ve made a simple mores code generator. It translates strings (all caps) into Mores code and uses one digital channel to play it on a buzzer. The circuit diagram involves one buzzer pushed into pins GND and 11. I loaded a sentence from wiki and compared the wave forms with audacity. It seems to be doing its job. All Mores codes are stored in the ASCII sequence start with the SPACE and ending with Z. Did not include “$” since it’s too long. Surprised myself that 30+ lines of code is all that’s needed.

Here is the code:

#define period 90 //13.33 WPM
#define buzzerPin 11
unsigned char message[]="WELCOME TO WIKIPEDIA, THE FREE ENCYCLOPEDIA THAT ANYONE CAN EDIT.   ";
unsigned char space_to_Z[][8]={" ", "!-.-.--", "\".-..-.", "# ", "$ ", "% ", "&.-...", "\'.----.", "(-.--.", ")-.--.-", "* ", "+.-.-.", ",--..--", "m-....-", "p.-.-.-", "/-..-.", "0-----", "1.----", "2..---", "3...--", "4....-", "5.....", "6-....", "7--...", "8---..", "9----.", ":---...", ";-.-.-.", "< ", "=-...-", "> ", "?..--..", "@.--.-.","A.-", "B-...", "C-.-.", "D-..", "E.", "F..-.", "G--.", "H....", "I..", "J.---", "K-.-", "L.-..", "M--", "N-.", "O---", "P.--.", "Q--.-", "R.-.", "S...", "T-", "U..-", "V...-", "W.--", "X-..-", "Y-.--", "Z--.."};
void setup()
{
}

void loop()
{
  char pointer=0;
  char pointer2=0;
  while (pointer2>=0)
  {
    if ((message[pointer2]>=' ')&&(message[pointer2]<='Z'))
    {
      unsigned char character=message[pointer2]-' ';
      pointer=0;
      while (pointer>=0)
      {
        switch(space_to_Z[character][pointer])
        {
          case '.':
            di();
            break;
          case '-':
            dah();
            break;
          case ' ':
            delay(6*period);
            break;
          case '\0':
            delay(2*period);
            pointer=-2;
            break;
          default :
            break;
        }
        pointer++;
      }      
    }
    else if (message[pointer2]=='\0') pointer2=-2;
    pointer2++;
  }  
}  
    
void di()
{
  analogWrite(buzzerPin, 2.5);
  delay(period);
  analogWrite(buzzerPin,0);
  delay(period);
}

void dah()
{
  analogWrite(buzzerPin, 2.5);
  delay(3*period);
  analogWrite(buzzerPin,0);
  delay(period);
}

I have included the characters with the Mores code for easy reference but they don’t make a sound. Will make a video later.

Here is the video on youtube: http://www.youtube.com/watch?v=3FcM1xGBCm8

Waveform comparison: http://picasaweb.google.com/lh/photo/LuNulFEicIx0ImF8NDSo9w?feat=directlink Top is from wiki and bottom is mine.