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

 
#include <ESP8266WiFi.h>

int BUTTON_PIN = 5; 
const char* ssid = "Forum";
const char* password = "HACK2017";
const char* mqtt_server = "172.16.0.1";

WiFiClient espClient;
PubSubClient client(espClient);

            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( topic , message);
                  lastActive = now;
                    
                }
                          
          }
          
          lastStatus = 1;
      
      }else{
       
          lastStatus  = 0;
     
     }
