             char message[2];
             message[1] = 0;
             
-            if(now-lastActive > 10*1000 ){
-              
-              message[0] = 'k';
-              Serial.println(message);
-              
-              //publish sensor data to MQTT broker
-              client.publish("/theringbot/ring", message);
-              lastActive = now;
-            }
-          
+                if(now-lastActive > 10*1000 ){
+                  
+                  message[0] = 'k';
+                  Serial.println(message);
+                  
+                  //publish sensor data to MQTT broker
+                  client.publish( topic , message);
+                  lastActive = now;
+                    
+                }
+                          
           }
           
           lastStatus = 1;
-      }
-     else
-     {
+      
+      }else{
+       
           lastStatus  = 0;
      
      }

} //end reconnect()

void setup() {
  
  Serial.begin(115200);
  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
  pinMode(BUTTON_PIN,INPUT);
}

long lastActive = 0;

    {
      Serial.println("connected");
     //once connected to MQTT broker, subscribe command if any
     // client.subscribe( topic );
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
