     while(!Serial); // Leonardo "feature"
 #endif
 
-    startupSequence();
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
+    startupSequence();    
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+const char *BUFFER_FULL_msg = "BUFFER_FULL",
+    *INVALID_OSC_msg = "INVALID_OSC",
+    *ALLOCFAILED_msg = "ALLOCFAILED",
+    *INDEX_OUT_OF_BOUNDS_msg = "INDEX_OUT_OF_BOUNDS",
+    *unknown_msg = "unknown";
+
+void sendOSCMessageError(class OSCMessage &message) {
+    OSCErrorCode code = message.getError();
+    const char *name;
+
+    switch(code) {
+      case BUFFER_FULL:
+          name = BUFFER_FULL_msg;
+          break;
+      case INVALID_OSC:
+         name = INVALID_OSC_msg;
+         break;
+      case ALLOCFAILED:
+         name = ALLOCFAILED_msg;
+         break;
+      case INDEX_OUT_OF_BOUNDS:
+         name = INDEX_OUT_OF_BOUNDS_msg;
+         break;
+      default:
+         name = unknown_msg;
+    } 
+    
+    sprintf(errstr, "OSC message hasError (error type: %s)", name);
+    sendError(errstr);
+}
+
 
 void receiveOSCMessage(class OSCMessage &messageIn) {
-    writeRGBColor(CYAN);
+    writeRGBColor(WHITE);        
 
     if (messageIn.hasError()) {
-        sendError("OSC message hasError");
+        sendOSCMessageError(messageIn);
     } else {
-//char addrBuffer[100];
-//messageIn.getAddress(addrBuffer, 0);
-//sprintf(errstr, "address of message: %s", addrBuffer);
-//sendInfo(errstr);
-        int called;
-        called = messageIn.dispatch("/exo/tt/morse", receiveMorseMessage);
-        called = messageIn.dispatch("/exo/tt/photo/get", receivePhotoGetMessage);
-        called = messageIn.dispatch("/exo/tt/ping", receivePingMessage);
-        called = messageIn.dispatch("/exo/tt/rgb/set", receiveRgbSetMessage);
-        called = messageIn.dispatch("/exo/tt/vibro", receiveVibroMessage);
-    }
-
-    messageIn.empty();
-    writeRGBColor(GREEN);  
+        writeRGBColor(GREEN);  
+
+        boolean called = 0
+        || messageIn.dispatch("/exo/tt/morse", receiveMorseMessage)
+        || messageIn.dispatch("/exo/tt/photo/get", receivePhotoGetMessage)
+        || messageIn.dispatch("/exo/tt/ping", receivePingMessage)
+        || messageIn.dispatch("/exo/tt/rgb/set", receiveRgbSetMessage)
+        || messageIn.dispatch("/exo/tt/vibro", receiveVibroMessage)
+        ;
+    }
 }
 
 void sendOSC(class OSCMessage &messageOut) {

}

void sendPingReply() {
    OSCMessage m("/exo/tt/ping/reply");
    m.add((int32_t) micros());
    
    sendOSC(m);  
}


////////////////////////////////////////////////////////////////////////////////

OSCMessage messageIn;

void loop() {    
#ifdef USE_BLUETOOTH
    // this must be kept in loop() to receive events via Amarino
    //meetAndroid.receive();  

    if (int size = SLIPSerial.available() > 0) {
        while (size--) {
            messageIn.fill(SLIPSerial.read());
            
            // note: we may start writing before we are done reading available bytes
            if (SLIPSerial.endofPacket()) {
                receiveOSCMessage(messageIn);
            }
        }
    }
#endif

    readKeys();
    
    if (keyState != lastKeyState) {
        colorDebug();
//sprintf(errstr, "input changed from %d to %d\n", lastKeyState, keyState);
//ƒsendInfo(errstr);  
        
        // bells and whistles
        if (keys[4] == HIGH) {

////////////////////////////////////////////////////////////////////////////////

void receiveMorseMessage(class OSCMessage &m) {
  //sendInfo("received morse message");
    if (m.isString(0)) {
        writeRGBColor(YELLOW);
        
        int length = m.getDataLength(0);
        char buffer[length+1];
        m.getString(0, buffer, length+1);   
        
        playMorseString(buffer, morseStopTest); 
    } else {
        sendError("expected string argument to Morse code control");
    }  
}

void receivePhotoGetMessage(class OSCMessage &m) {
    writeRGBColor(WHITE);    
    
    sampler_photoresistor.reset();
    sampler_photoresistor.beginSample();
    sampler_photoresistor.measure();
