   pinMode(out3, OUTPUT);
   pinMode(out4, OUTPUT);
   pinMode(out6, OUTPUT);
-  client.setCallback(callback);
-  lastReconnectAttempt = 0;
+  
 
-//if (client.connect(IOTID, IOTUSERNAME, IOTPASSWORD)) {
-//  client.publish(STATUS,"hello world - authenticated!!");
-//  client.subscribe(TOPIC);
-//  }
- 
+  if (client.connect(IOTID, IOTUSERNAME, IOTPASSWORD)) {
+   client.publish(STATUS,"hello world - authenticated!!");
+   client.subscribe(TOPIC);
+  }
 }
-
 
 void loop()
 {
-  if (!client.connected()) {
-    long now = millis();
-    if (now - lastReconnectAttempt > 5000) {
-      lastReconnectAttempt = now;
-      // Attempt to reconnect
-      if (reconnect()) {
-        lastReconnectAttempt = 0;
-      }
-    }
-  } else {
-    // Client connected
+  client.loop();
+}
 
-    client.loop();
-  }
-
-}

 
}

boolean reconnect() {
  if (client.connect(IOTID, IOTUSERNAME, IOTPASSWORD)) {
  client.publish(STATUS,"hello world - authenticated!!");
  client.subscribe(TOPIC);
  }
  
  return client.connected();
}

void setup()
{

#define IOTID USERNAME"/"IOTDEVICE

IPAddress server(190, 97, 169, 126);


void callback(char* topic, byte* payload, unsigned int length);
