I’m trying to print out a float number for debugging purposes, using
float foo; (snip) printf("%2.2f", foo);
This prints a “?” instead of the number I’m looking for. From the documentation for the AVR runtime library <stdio.h> I can see this is the expected behaviour when the default runtime libraries are used:
Since the full implementation of all the mentioned features becomes fairly large, three different flavours of vfprintf() can be selected using linker options. The default vfprintf() implements all the mentioned functionality except floating point conversions.
If the full functionality including the floating point conversions is required, the following options should be used:
-Wl,-u,vfprintf -lprintf_flt -lm
This is fine, except that I’m not invoking the compiler and linker myself, the Arduino IDE is doing it for me and I don’t see any way within the IDE to change the linker options. Have you got any idea of possible ways to print floating point values? I really would prefer not to roll my own formatter if I can help it.