   if (bufferLength != cmdPixelLength)
   {
     // The command was too long or too short
-    Serial.println("ERROR: drawPixel wrong length.");
+    Serial.println("ERROR: Command \"drawPixel\" had the wrong length!");
     return;
   }
 

  {
    case cmdBrightness: setBrightness(); break;
    case cmdFrame: drawFrame(); break;
    //case cmdRow: break;
    //case cmdColum: break;
    case cmdPixel: drawPixel(); break;
    //case cmdSave: break;
    default: Serial.println("Error: Unknown Command!"); break;
  }
}

  strBlue[0] = buffer[7];
  strBlue[1] = buffer[8];

  // Convert the strings to ints
  red = (uint8_t)strtol(strRed, NULL, 16);
  green = (uint8_t)strtol(strGreen, NULL, 16);
  blue = (uint8_t)strtol(strBlue, NULL, 16);

  // Set the pixel color and update the matrix.
  strip.setPixelColor(stripPixel, red, green, blue);
  strip.show();
}


/*
* This function reads the hex color values from the buffer and writes the frame
* to the matrix.
*/
void drawFrame()
{
  // Checking if the command has the right length
  if (bufferLength != cmdFrameLength)
  {
    // The command was too long or too short
    Serial.println("ERROR: Command \"drawFrame\" had the wrong length!");
    return;
  }

  // Declare all variables needed for this function
  uint8_t curPixel = 0;
  uint8_t curColum = 0;
  uint8_t red = 0;
  uint8_t green = 0;
  uint8_t blue = 0;
  uint16_t offset = 1;
  char strRed[3] = "";
  char strGreen[3] = "";
  char strBlue[3] = "";

  // Loop through all 256 pixels (each 6 Byte)
  for (uint8_t r = 0; r < 16; r++)
  {
    for (uint8_t c = 0; c < 16; c++)
    {
      curColum = c;

      // Fix the snake pattern if needed
      #if MATRIX_SNAKE_PATTERN == 1
      if (r % 2 == 1) curColum = 15 - curColum;
      #endif

      // calculate the current pixel
      curPixel = (r << 4) + curColum; // shift by 4 is like multiply by 16 but faster

      // Set the strings for the colors
      strRed[0] = buffer[offset + 0];
      strRed[1] = buffer[offset + 1];
      strGreen[0] = buffer[offset + 2];
      strGreen[1] = buffer[offset + 3];
      strBlue[0] = buffer[offset + 4];
      strBlue[1] = buffer[offset + 5];
      offset += 6;

      // convert the strings to numbers
      red = (int)strtol(strRed, NULL, 16);
      green = (int)strtol(strGreen, NULL, 16);
      blue = (int)strtol(strBlue, NULL, 16);

      // Set the current pixel
      strip.setPixelColor(curPixel, red, green, blue);
    }
  }

  // Update the matrix
  strip.show();
}

