 #define LED         4
 #define DS18B20     5 // Dallas DS18B20 digital thermometer
 
+
+unsigned int i = 0;
 unsigned int brightness = 1023;
-
+bool led_on = false;
 // Create an ESP8266 WiFiClient class to connect to the MQTT server.
 WiFiClient client;
 

  Adafruit_MQTT_Subscribe *subscription;
  while ((subscription = mqtt.readSubscription(10000))) {

    if (strcmp((char *)onoffsw.lastread, "{\"On\":1}") == 0) {
      Serial.println(F("On"));
      i = 0;
      while (i < brightness) {


  WiFi.begin(WLAN_SSID, WLAN_PASS);
  if (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(F("."));
  }
  Serial.println();
