   unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 + LWS_SEND_BUFFER_POST_PADDING];
   unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];
 
-//  getSerialCommand(); 
-//  if( !g_iNewCode )
- // {
-
-    // OLD CODE
-    Serial.println("OLD CODE");
-
-    // Send HW status to website
-    n = sprintf((char *)p, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
-    g_abD[0],
-    g_abD[1],
-    g_abD[2],
-    g_aiP[3],   // Px
-    g_abD[4],
-    g_aiP[5],   // Px
-    g_aiP[6],   // Px
-    g_abD[7],
-    g_abD[8],
-    g_aiP[9],   // Px
-    g_aiP[10],  // Px
-    g_aiP[11],  // Px
-    g_abD[12],
-    g_abD[13],
-    analogRead(A0),
-    analogRead(A1),
-    analogRead(A2),
-    analogRead(A3),
-    analogRead(A4),
-    analogRead(A5)
-      );
-
-//  }
-//  else
-//  {
-    // NEW CODE
+  //  getSerialCommand(); 
+  //  if( !g_iNewCode )
+  // {
+
+  // OLD CODE
+  Serial.println("OLD CODE");
+
+  // Send HW status to website
+//  n = sprintf((char *)p, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
+  n = sprintf((char *)p, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%f,%f,%f,%f,%f",
+  g_abD[0],
+  g_abD[1],
+  g_abD[2],
+  g_aiP[3],   // Px
+  g_abD[4],
+  g_aiP[5],   // Px
+  g_aiP[6],   // Px
+  g_abD[7],
+  g_abD[8],
+  g_aiP[9],   // Px
+  g_aiP[10],  // Px
+  g_aiP[11],  // Px
+  g_abD[12],
+  g_abD[13],
+  analogRead(A0)/float(ANALOG_IN_MAX_VALUE),
+  analogRead(A1)/float(ANALOG_IN_MAX_VALUE),
+  analogRead(A2)/float(ANALOG_IN_MAX_VALUE),
+  analogRead(A3)/float(ANALOG_IN_MAX_VALUE),
+  analogRead(A4)/float(ANALOG_IN_MAX_VALUE),
+  analogRead(A5)/float(ANALOG_IN_MAX_VALUE)
+    );
+
+  //  }
+  //  else
+  //  {
+  // NEW CODE
+
+  ////// NEW JSON CODE /////
+  /*
+    updateBoardState();
+   aJsonObject *msg = getJsonBoardState();
+   
+   aJson.print(msg, &serial_stream);
+   Serial.println("");
+   aJson.deleteItem(msg);
+   */
+  /*
+    // Creating buffer for WebSockets
+   int n;
+   // unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 + LWS_SEND_BUFFER_POST_PADDING];
+   // unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];
+   unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 + LWS_SEND_BUFFER_POST_PADDING];
+   unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];
+   
+   // Get JSON string
+   p = (unsigned char *)(aJson.print(msg));
+   
+   // Free memory
+   aJson.deleteItem(msg);
+   */
+
+
+  //   aJson.print(msg, &serial_stream);
+  //    Serial.println("");
+  //   aJson.deleteItem(msg);
+
+  // }
+
+  //Serial.print("Output Message [sendStatusToWebsite()]:");
+  //Serial.println(n);
+  n = libwebsocket_write(wsi, p, n, LWS_WRITE_TEXT); 
+
+  return n;
+}
+
+static long unsigned int g_luiCounter = 0;
+int  sendStatusToWebsiteNew(struct libwebsocket *wsi)
+{
+
+  int n = 0;
+
+  if( g_luiCounter%100 == 0)
+  {
+    Serial.println("NEW CODE");
+
+    unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 + LWS_SEND_BUFFER_POST_PADDING];
+    unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];
+    /*
+      // Send HW status to website
+     n = sprintf((char *)p, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
+     g_abD[0],
+     g_abD[1],
+     g_abD[2],
+     g_aiP[3],   // Px
+     g_abD[4],
+     g_aiP[5],   // Px
+     g_aiP[6],   // Px
+     g_abD[7],
+     g_abD[8],
+     g_aiP[9],   // Px
+     g_aiP[10],  // Px
+     g_aiP[11],  // Px
+     g_abD[12],
+     g_abD[13],
+     analogRead(A0),
+     analogRead(A1),
+     analogRead(A2),
+     analogRead(A3),
+     analogRead(A4),
+     analogRead(A5)
+     );
+     
+     n = libwebsocket_write(wsi, p, n, LWS_WRITE_TEXT); 
+     */
 
     ////// NEW JSON CODE /////
-    /*
+
     updateBoardState();
     aJsonObject *msg = getJsonBoardState();
+    //p = (char *)(aJson.print(msg));
+    char * pTempPointer = aJson.print(msg);
+    p = (unsigned char *)pTempPointer;
+    //    Serial.println("");
 
     aJson.print(msg, &serial_stream);
     Serial.println("");
     aJson.deleteItem(msg);
-*/
+
     /*
-    // Creating buffer for WebSockets
+      // Creating buffer for WebSockets
      int n;
      // unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + 512 + LWS_SEND_BUFFER_POST_PADDING];
      // unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];

     aJson.deleteItem(msg);
     */

    //   aJson.print(msg, &serial_stream);
    //    Serial.println("");
    //   aJson.deleteItem(msg);

    // }

    //Serial.print("Output Message [sendStatusToWebsite()]:");
    //Serial.println(n);

    n = libwebsocket_write(wsi, p, n, LWS_WRITE_TEXT); 

    aJson.deleteItem(msg);
  }

  g_luiCounter++;

  return n;
}
