General Arduino

Arduino sprintf float not formatting

userHead DeepMohinman 2022-08-31 19:29:52 838 Views1 Replies

I have this arduino sketch,

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

temperature prints out as

? F

Any thoughts on how to format this float? I need it to be a char string.

2023-02-24 16:17:06

Hi

Could you please refer to this article? It will show you how to convert float to char.

https://www.quora.com/What-is-the-process-of-converting-float-to-char-in-C

Hope it can help.

userHeadPic NeloKin