I'm working on a home automation project using Arduino and MQTT.
I've found a problem and my limited programming knowledge find a way to solve it.
I can send text trough MQTT normally, using
client.Publish("some/topic","Some text here");
But when I try to send a variable (int, char, etc), the compiler says "invalid conversion from 'char' to 'const char*' [-fpermissive]"
How can I store DHT11 sensor reading in const char* to send it?
BTW, I've found this code where
char *tempC;
tempC = dtostrf(((((analogRead(tempPinIn) * 5.0) / 1024) - 0.5) * 100), 5, 2, message_buffer);
client.publish("arduino/temperature",tempC);
is used. But the extra sensor calibration makes it even harder for me to understand whats going on.