1

Topic: Printing Temperature Data

Hi there,

I am using ESP8266, BME280, and Arduino UNO together to print temperature data on my phone screen.
For that, I am using the following code.

  float Temperature;
  char str1[] = " °C";
  Temperature = BME280.readTemperature();
  sprintf (RemoteXY.Text_Temp, "%f %s", Temperature, str1);

In the application, I am using Text string.

And in output, I am getting the following :  ? °C
How can I solve this issue and get actual temperature value instead of ?

Thank you in advance.

2

Re: Printing Temperature Data

Welcome,

sprintf doesn't work with floats on Arduino boards, unless you do what I described here : https://forum.arduino.cc/index.php?topi … msg2157645

It might be a better idea to first convert the float to a string using dtostrf, and then using this string in sprintf