Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Mosquitto » if (topic == "TEST")(How do i wright the topics with subtopics)
if (topic == "TEST") [message #1848524] Tue, 07 December 2021 01:41
Erik doedel is currently offline Erik doedelFriend
Messages: 1
Registered: December 2021
Junior Member
Hello all,

I have a sensor that posts it value to a MQTT topic with a sub topic.
Mean topic is SCD
sub topic is temperature

Now how do i wright dis down in the following part."

 if (topic == "TEST")

Wen i have
void callback(char* topic, byte* payload, unsigned int length) {

  Serial.print("Message arrived in topic: ");
  Serial.println(topic);
  Serial.print("Message:");

  for (int i = 0; i < length; i++) {
    Serial.print((char)payload[i]);
  }

  if (topic == "SCD/temperature") {
    Serial.println("Received"));
  }

}


I do receive this in the monitor:
23:27:31.092 -> Ambient = 20.47C Object = 20.05C

But its not posting "Received"

Previous Topic:Cannot connect to Mqtt brober
Next Topic:Local mode only
Goto Forum:
  


Current Time: Fri Apr 26 03:58:58 GMT 2024

Powered by FUDForum. Page generated in 0.02590 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top