void mqttPublishFeed(float field1, float field2, float field3, float field4, float field5, float field6, float field7, float field8) {
// Create data string to send to ThingSpeak.
String data = "field1=";
data += String(field1, DEC);
data += "&field2=";
data += String(field2, DEC);
data += "&field3=";
data += String(field3, DEC);
data += "&field4=";
data += String(field4, DEC);
data += "&field5=";
data += String(field5, DEC);
data += "&field6=";
data += String(field6, DEC);
data += "&field7=";
data += String(field7, DEC);
data += "&field8=";
data += String(field8, DEC);
int length = data.length();
const char *msgBuffer;
msgBuffer=data.c_str();
Serial.println(msgBuffer);
// Create a topic string and publish data to ThingSpeak channel feed.
String topicString = "channels/" + String( channelID ) + "/publish/"+String(apiKey);
Serial.println(topicString);
length = topicString.length();
const char *topicBuffer;
topicBuffer = topicString.c_str();
mqttClient.publish( topicBuffer, msgBuffer );
lastConnectionTime = millis();
}