Difficulties formatting floating point strings

I’m having wired difficulties formatting floating point strings. When i run std::to_string the machine simply hangs. Using sprintf and friends e.g. with %f just leaves the buffer empty. Do you have any ideas what might be going on?

Adding floating point support to string functions requires quite a bit of extra memory and isn’t supported with the configuration of newlibnano we’re using. There is a way to get it set up and just have it use a few extra kB of memory, but we don’t have configuration for this set up in libdaisy yet.

A pretty simple work around is to just multiply the floating point value by 10 to the power of however many decimals you care about. So if you only need two decimal places you can multiply by 100.

Hope that helps!

1 Like

I ran into the same, wanting to print the actual values of the pots (music was still playing softly, since the values of pots started at 0.002)

Here is a modified QuadMixer example usage of sprintf using 7kb of memory

It uses https://github.com/mpaland/printf

Thanks! That worked for me.