Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino demo source code for KC868-A4]-14 MQTT demo
#18
(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
  }
}
Reply


Messages In This Thread
RE: [Arduino demo source code for KC868-A4]-14 MQTT demo - by ledouble33 - 03-10-2023, 09:17 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)