     myPID.SetMode(AUTOMATIC);
     
     // Last event timestamp
-    lastEventTimestamp = 0;
+    lastEventTimestamp = 0;    
 }
  
  // Loop
 void loop() {
     
     // Searching for the ds18b20 device
-    if(!ds18b20.search()){
+    if(actualTemperature == 0 && !ds18b20.search()) {        
         
         // Log to the serial
         Serial.println("No more addresses.");

        sprintf(pwmInfo, " %2.2f", (pidOutput / 255) * 100);
        
        // Log to the serial
        Serial.println(tempInfo);
        Serial.println(pwmInfo);
        
        // SparkCore: publish
        Spark.publish("tempInfo", tempInfo);
        Spark.publish("pwmInfo", pwmInfo);
        
        // Save timestamp of the event
        lastEventTimestamp = millis();
    }
  
    // Control relay
    analogWrite(relayPin, pidOutput);
}


// set point temperature
int setPointTemperature(String pointTemperatureStr)
{
    char info[64];
    
    // Convert to double
    pointTemperature = atof(pointTemperatureStr.c_str());
    
    // Log to the serial
    sprintf(info, "Point is set to: %2.2f", pointTemperature);
    Serial.println(info);
    
    return 1;
}

        ds18b20.resetsearch();
        delay(250);
        
        return;  
    }     
    
    
    // Send event to the SparkCloud
    if (millis() - lastEventTimestamp >= 1000) {

        // Actual temperature in celsius
        actualTemperature = ds18b20.getTemperature();

        // Compute PID
        if(myPID.Compute()) {
            
            // Control relay
            analogWrite(relayPin, pidOutput);
        }
        
        // Convert values for output
        // convert pidOutput to 0-100
