     }
     digitalWrite(13,1);
     Serial.println();
-    Serial.print(m2xpos);
+    Serial.print(samplecnt);
     Serial.println(" records to send to M2X iot server");
     
     showCounters(counts,m2xpos);
     showStreamnames(streamNames,m2xpos);
-    showTimes(ats,m2xpos);
-    showValues(values,m2xpos);
+    showTimes(ats,samplecnt);
+    showValues(values,samplecnt);
 
     response = m2xClient.postMultiple(feedId, m2xpos, streamNames,
 				      counts, ats, values);
+
     digitalWrite(13,0);
     Serial.print("M2x client response code: ");
     Serial.println(response);

  struct dig2a delta;
};

/*
struct cnt {
  int *counter;
  char *name;
  int flags;
  int last_send;
  struct dig2a prev;
  struct dig2a diff;
  struct dig2a scale;
  struct dig2a measured;
};
*/

struct ad adArr[]= {          //prev   dif    min       max         meas    delta
  {0,"boiler",       0,0,     0,0.0, 0,0.5, 174,21.0, 935, 100.0,  0,0.0,  0,0.0},

  setSyncProvider(getNtpTime);
  sched.every(1000,processAD);
  sched.every(200,checkEthernet);
  cntArr[0].last_send=now();
  attachInterrupt(1, elmeter, CHANGE);
}

