@Override
	@SuppressWarnings("unchecked")
	public void setMatrix(Color[][] colorMatrix) throws L8Exception 
	{
		try {
			JSONObject message = new JSONObject();
			for (int i = 0; i< colorMatrix.length; i++) {
				for (int j = 0; j < colorMatrix.length; j++) {
					message.put("led" + i + j, printColor(colorMatrix[i][j]));
				}
			}
			for (int i = 0; i < 8; i++) {
				message.put("frame" + i, "");
				message.put("frame" + i + "_duration", 0);
			}
			Response response = this.client.put("/l8s/" + this.simul8torToken, message);
			if (response.getCode() != 200) {
				throw new L8Exception("Error updating simul8tor matrix");
			}		
		} catch (Exception e) {
			throw new L8Exception(e);
		}
	}