   Serial.println(cmd);  
 }
 
+void playMidiNote(bool on, int note) 
+{
+  if (gMidi == false)
+  {
+    return;
+  }
+  char cmd = on ? MIDICMD_NOTEON : MIDICMD_NOTEOFF;
+  char data1 = 0x4a + note;
+  char data2 = 0x49;
+  Serial.print(cmd);
+  Serial.print(data1);
+  Serial.print(data2);
+}
+
+void playGinsingNote(bool on, int note)
+{
+  if (gGinsing == false)
+  {
+    return;
+  }
+
+  if (on == true)
+  {
+    gGSPoly->setNote(1, gGSNote[note]);
+    gGSPoly->trigger(1);
+  }
+  else
+  {
+    gGSPoly->release(1);
+  }
+}
+  
+  
+void playNote(bool on, int note)
+{
+  if (on == true && gMute == true) 
+  {
+    return;
+  }
+
+  playMidiNote(on, note);
+
+  playGinsingNote(on, note);
+}
+
+
+void playNotesCmd()
+{
+  Serial.println(F("Running playNoteCmd"));
+  Serial.print(F("Playing notes: "));
+  for (int iNote = 0; iNote < NOTE_COUNT_MAX; iNote++)
+  {
+    Serial.print(iNote); Serial.print(F(" "));
+    playNote(true, iNote);
+    delay(250);
+    playNote(false, iNote);
+  }
+  Serial.println();
+}
+
 void setupSerialCommands()
 {
   sCmd.addCommand("SampleLight", sampleLightCmd);
   sCmd.addCommand("SetLightSensitivity", setLightSensitivityCmd);
   sCmd.addCommand("SetNoteCount", setNoteCountCmd);
-  //sCmd.addCommand("PlayNote")
+  sCmd.addCommand("AutoPosition", autoPositionMirror);
+  sCmd.addCommand("PlayNotes", playNotesCmd);
   sCmd.setDefaultHandler(unrecognizedSerialCmd);  
 }
 
+void setupGinsing()
+{
+  if (gGinsing == false)
+  {
+    return;
+  }
+  
+  Serial.println(F("Setting up ginsing"));
+
+#define rcvPin  4       // this is the pin used for receiving    ( can be either 4 or 12 )
+#define sndPin  3       // this is the pin used for transmitting ( can be either 3 or 11 ) 
+#define ovfPin  2       // this is the pin used for overflow control ( can be either 2 or 10 )
+  gGS.begin( rcvPin , sndPin , ovfPin );
+
+//  GinSingVoice *voice = gGS.getVoice();                    // get the interface for voice mode
+//  voice->begin();                                         // enter voice mode
+//  voice->preview();                                       // preview the mode
+
+  gGSPoly = gGS.getPoly();                           // get the poly mode interface
+  gGSPoly->begin ();  // enter poly mode
+}
+
 void setup()
 {
+  setupSerialCommands();
+
   Log.Init(gLogLevel, BAUD);
 
   //For the light sensor
   analogReference(EXTERNAL);
 
+  setupGinsing();
+  
   setupMotor();  
 
   //Get some initial values for each light string
   gLightAverage = sampleLight(50);
 
-  setupSerialCommands();
 }
 
 //Read the sonar unit and figure out if the


void setNoteCountCmd() 
{
  Serial.println(F("Running setNoteCountCmd"));
  char * str = sCmd.next();
  if (str && *str)
  {
    int val = atoi(str);
    if (val > 1)
    {
      Serial.print(F("Before: ")); Serial.println(gNoteCount);
      gNoteCount = val;

    if (currentlyOn != detected)
    {
      Log.Info("Note %d %s!\n", note, detected ? "on" : "off");
      playNote(detected, note);
    }
          
  }
