     {
       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());

            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;
            }
          
          }
          
          lastStatus = 1;
      }
     else
     {
          lastStatus  = 0;
     
     }

} //end reconnect()

void setup() {

  digitalWrite(LED, LOW);
    Serial.begin(115200);
    setup_wifi();
  digitalWrite(LED, HIGH);
  
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
  pinMode(BUTTON_PIN,INPUT);

}

long lastActive = 0;
