03-10-2023, 09:17 AM
(This post was last modified: 03-10-2023, 09:18 AM by ledouble33.)
(03-09-2023, 02:17 PM)admin Wrote: you can use serial output ds18b20 value in different code position, test which section have issue.
I found
I created a read function of 2 probes and send by mqtt
tank you
Code:
void lecturePublication()
{
long now = millis();
//Envoi d'un message par minute
if (now - lastMsg > 1000 * 10) {
lastMsg = now;
sensors.requestTemperatures();
float temp_depart = sensors.getTempC(sensor1);
float temp_retour = sensors.getTempC(sensor2);
if ( debug ) {
Serial.print("Temperature : ");
Serial.print("Sensor 1(*C): ");
Serial.print(sensors.getTempC(sensor1));
Serial.print("Sensor 2(*C): ");
Serial.print(sensors.getTempC(sensor2));
}
client.publish(temperature_topic_depart, String(temp_depart).c_str(), true); //Publie la température sur le topic temperature_topic_depart
client.publish(temperature_topic_retour, String(temp_retour).c_str(), true); //Publie la température sur le topic temperature_topic_retour
}
}