 
 void setup() {
     Serial.begin(115200);
+    pinMode(0, INPUT_PULLUP);
     delay(10);
 
+    connect_wifi();
     init_dht(&dht, DHTPIN, DHTTYPE);
-
-    connect_wifi();
 
     mqtt = new MqttWrapper("128.199.104.122");
     mqtt->connect(callback);

MqttWrapper *mqtt;
DHT *dht;

void init_dht(DHT **dht, uint8_t pin, uint8_t dht_type);
void read_dht(DHT *dht, float *temp, float *humid);


void callback(const MQTT::Publish& pub) {
    if (pub.payload_string() == "0") {

void loop() {
    mqtt->loop();

    if (digitalRead(0) == LOW) {
        while(digitalRead(0) == LOW) { 
            mqtt->loop();
            yield(); 
        }
        mqtt->sync_pub(String("0"));
    }

}
