void loop()
{
float temperature = dht.readTemperature();
char test[50];
sprintf(test, "Temp: %f", temperature);
Serial.println(temperature); // works fine
Serial.println(test); // why it prints "?"
delay(300);
}
// Output
24.10 <== Serial.println(temperature);
? <== Serial.println(test);
24.10
?
24.10
?
24.10
?
Hi. I'm arduino/c newbie. Why print test
is keep showing "?"
Am I missing something? When I running the below code in c++ playground, it works fine.
float temperature = 23.19;
char test[50];
sprintf(test, "Temp: %f", temperature);
printf("%s", test); <==== Works fine!