     {
       if( g_aPins[i].is_analog ) // Process analog pins
       {
-        g_aPins[i].value = analogRead(i)/float(ANALOG_IN_MAX_VALUE);
+        if( g_aPins[i].is_inverted )
+          g_aPins[i].value = 1.0 - analogRead(i)/float(ANALOG_IN_MAX_VALUE);
+        else
+          g_aPins[i].value = analogRead(i)/float(ANALOG_IN_MAX_VALUE);
       }
       else // Process digital pins
       {
-        g_aPins[i].value = digitalRead(i);
+        if( g_aPins[i].is_inverted )
+          g_aPins[i].value = 1.0 - digitalRead(i);
+        else
+          g_aPins[i].value = digitalRead(i);       
       }
     }
   }

  return n;
}

static long unsigned int g_luiCounter = 0;
int  sendStatusToWebsiteNew(struct libwebsocket *wsi)
{

  int n = 0;

//  if( g_luiCounter%100 == 0)
  {

    unsigned char buf[LWS_SEND_BUFFER_PRE_PADDING + WEB_SOCKET_BUFFER_SIZE + LWS_SEND_BUFFER_POST_PADDING];
    unsigned char *p = &buf[LWS_SEND_BUFFER_PRE_PADDING];
    
    updateBoardState();
        
    aJsonObject *msg = getJsonBoardState();  
    
    aJsonStringStream stringStream(NULL, (char *)p, WEB_SOCKET_BUFFER_SIZE);
    aJson.print(msg, &stringStream);
    String sTempString((char *)p);
      
    n = libwebsocket_write(wsi, p, sTempString.length(), LWS_WRITE_TEXT);
    
    aJson.deleteItem(msg);

  }

  g_luiCounter++;

  return n;
}


      aJsonObject *poValue = aJson.getObjectItem(poPinVals, "value");
      if (poValue)
          g_aPins[i].value = getJsonFloat(poValue);      
//        g_aPins[i].value = poValue->valuefloat;
     
      aJsonObject *poIsTimerOn = aJson.getObjectItem(poPinVals, "is_timer_on");
