Arduino sprintf float not formatting

前端 未结 4 840
离开以前
离开以前 2020-12-02 16:50

I have this arduino sketch,

char temperature[10];
float temp = 10.55;
sprintf(temperature,\"%f F\", temp);
Serial.println(temperature);

tem

4条回答
  •  醉梦人生
    2020-12-02 17:07

    dtostrf() is deprecated, and it doesn't exist on every board core platforms. On the other hand, sprintf() doesn't format floats on AVR platforms!

提交回复
热议问题