Hello,
I am using an Arduino mega with PubSub Client 2.8.0
I want to subscribe to two topics and need to distinguish which topic has arrived in the calback routine.
When the message arrives I can Serial.print the topic (See below). But when I try to test the topic name with an if statement the if never proves true.
void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("Message arrived [");
Serial.print(topic);
if(topic=="Broadcast"){ //why doesn't this work?
Serial.println("Broadcast RX");
}
Seems simple but it is baffling to this noobe. Any help is greatly appreciated.