Hacking the IDE: Floating points


I am looking to be able to print floating points to an LCD on a custom board. I have it all compile and everything, but the original API used required an additional library to be linked for floating point stuff on the LCD (libprintf_flt.a). Using an ISP, I'd like to avoid a bootloader, which I see is using the library on some of the boards. Is there any way to link this library, rather than define additional functions? The board uses the ATMega324P MCU and it was used previously, so I don't think space is going to be a problem.

Thanks for your input,


The answer is here in this forum But I'll not search it for you or tell you where to look because you've shown no more effort than to ask a question, thus all the other answers you got... Mr Google is your friend.

What I've shown is that I've asked a question and no more, but in reality, I have been dealing with this issue for the last two weeks? I've moved to convert a static C library to something arduino can use because of the fact that I can't link a static library. I've got a temporary solution for printing to the LCD for using a function that gathers the digits after a decimal and you can manually output that way. I'd rather not do this as it adds one more step to the user beyond the IDE capabilities if we can link the libprintf_flt.a into the sketch without using a bootloader (this board uses a ISP).

Before assuming I did nothing more and chastising me of this, perhaps you should ask what I've tried. Otherwise you just come off as rude and very unfriendly, which isn't something you want a first time user of an arduino board to witness, otherwise that stereotype will cause this product to fail overall. So now, try again, what am I missing?

Also... to humor you, I searched for libprintf_ftl in the forums, and look... there's nothing. Next time, do your own search or suggest search terms that I might be missing instead of wasting your time and mine.

My new library can help, here is a link to a working version: String/sprintf alternative specifically for Arduino. - #15 by pYro_65 - Libraries - Arduino Forum
A new version will be out soon.

As I supply my own core and whatnot, this looks like it might be the solution. I appreciate your work and letting me know of it.

Unfortunately I get compile errors with your includes. Most likely because my core uses stdio.h in a few places (IDK why, but I didn't write the original code). I'll have to pound through the compiler errors and figure it out. Thanks.

Yes some things would have name conflicts. sprintf for example is part of sdtio.

You can wrap the GString library in a namespace, this may help:

namespace GS{
  #include "GString.h"

using namespace GS;

//This should call GString sprintf.

//If the compiler cannot disambiguate some calls, use: