I am getting a json object from aws iot MQTT. Assuming that json from aws is {status:opened}. Here is my code.
#include <ArduinoJson.h>
void messageHandler(char *topic, byte *payload, unsigned int length)
{
StaticJsonDocument<32> doc;
deserializeJson(doc, payload);
const char *status = doc["status"];
Serial.println(status);//opened
if (status == "opened")
{
Serial.println("door is opened");//not excute
}
else if (status == "closed")
{
Serial.println("door is closed");
}
}
Why the if condition is not being excute?