   if (client.connect((char*) clientName.c_str())) {
     Serial.println("Connected to MQTT broker");
     Serial.print("Topic is: ");
-    Serial.println(topic);
+    Serial.println(topicEvery);
 
     if (client.publish(hellotopic, "hello from ESP8266 s06")) {
       Serial.println("Publish ok");

       payload += x;
       payload += "}";

      sendHx711(payload);
    }

     if ( c == 1 ) {

       payload += x;
       payload += "}";

      sendHx711topicAverage(payload);
    }

}


void sendHx711topicEvery(String payload) {
  if (!client.connected()) {
    if (client.connect((char*) clientName.c_str())) {
      Serial.println("Connected to MQTT broker again HX711");
      Serial.print("Topic is: ");
      Serial.println(topicEvery);
    }
    else {
      Serial.println("MQTT connect failed");
