     g_aPins[i].is_visible = true;
     g_aPins[i].value = 0.0;
     
-    for(int j=0; j<TOTAL_NUM_OF_PAST_VALUES; j++)
-      g_aPins[i].past_values[j] = 0.0;
+ //   for(int j=0; j<TOTAL_NUM_OF_PAST_VALUES; j++)
+  //    g_aPins[i].past_values[j] = 0.0;
+    g_aPins[i].prev_values = 0.0;
     
     g_aPins[i].is_timer_on = false;
     g_aPins[i].timer_value = 0.0;
     g_aPins[i].damping = 0;
+    g_aPins[i].prev_damping = 0;
     
     // Set pin connections
     memset(g_aPins[i].connections, '\0', sizeof(g_aPins[i].connections));


  return n;
}


int  sendStatusToWebsiteNew(struct libwebsocket *wsi)
{


float getFilteredPinValue(int _iInPinNum)
{
  static float fFiltered = 0.0;

//  float fDelta = 1.0/pow(10,g_aPins[_iInPinNum].damping);
//  float fDelta = 1.0 - 0.99/9.0*float(g_aPins[_iInPinNum].damping);
  float fDelta = g_afFilterDeltas[g_aPins[_iInPinNum].damping];

  Serial.print("fDelta: "); Serial.println(fDelta);    

  if( fFiltered < g_aPins[_iInPinNum].value )
  {
    fFiltered += fDelta;
    if(fFiltered>g_aPins[_iInPinNum].value)
      fFiltered = g_aPins[_iInPinNum].value;
  }
  else if( fFiltered > g_aPins[_iInPinNum].value )  
  {
    fFiltered -= fDelta;
    if( fFiltered < g_aPins[_iInPinNum].value)
      fFiltered = g_aPins[_iInPinNum].value;
  }
  else
  {
    fFiltered = g_aPins[_iInPinNum].value;
  }

Serial.print("fFiltered: "); Serial.println(fFiltered);  
Serial.print("Value: "); Serial.println(g_aPins[_iInPinNum].value);  

    
  /*
  // Check if the damping value has changed
  if( g_aPins[_iInPinNum].damping != g_aPins[_iInPinNum].prev_damping )
  {
    // Clear the history values
    for(int i=0; i<TOTAL_NUM_OF_PAST_VALUES; i++)
      g_aPins[_iInPinNum].past_values[i] = 0.0;
  }
  
  g_aPins[_iInPinNum].damping
  
  g_aPins[_iInPinNum].value
  g_aPins[_iInPinNum].prev_value  
 */
  return fFiltered; 
}

/*
float getFilteredPinValue(int _iInPinNum)
{
  // Check if the damping value has changed
  if( g_aPins[_iInPinNum].damping != g_aPins[_iInPinNum].prev_damping )
  {
    // Clear the history values
    for(int i=0; i<TOTAL_NUM_OF_PAST_VALUES; i++)
      g_aPins[_iInPinNum].past_values[i] = 0.0;
  }
  
  // Update 
  g_aPins[_iInPinNum].prev_damping =   g_aPins[_iInPinNum].damping;
  
  // Update tap value
//  float fFilterTab = 1.0/(g_aPins[_iInPinNum].damping+1); // The sampling rate is so slow this filter can see it.
  float fFilterTab = 1.0/(g_aPins[_iInPinNum].damping*100+1); // The sampling rate is so slow this filter can see it.
  Serial.print("fFilterTab: "); Serial.println(fFilterTab);
  // Shift previous values
  for(int i=0; i<TOTAL_NUM_OF_PAST_VALUES-1; i++)
      g_aPins[_iInPinNum].past_values[i+1] = g_aPins[_iInPinNum].past_values[i];
  
  // Add new data
  g_aPins[_iInPinNum].past_values[0] = g_aPins[_iInPinNum].value;
    Serial.print("value: "); Serial.println(g_aPins[_iInPinNum].value);
  // Multiply and accumulate
  float fMultAndAccum = 0.0;
  for(int i=0; i<=g_aPins[_iInPinNum].damping*100; i++)
      fMultAndAccum += fFilterTab*g_aPins[_iInPinNum].past_values[i];
  Serial.print("MultAndAccum: "); Serial.println(fMultAndAccum);    
  return fMultAndAccum;
}
*/

////////////////////////////////////////////////
// Get the board state and return a JSON object
