Arduino: printf/fprintf prints question mark instead of float

后端 未结 4 930
别跟我提以往
别跟我提以往 2020-12-06 18:32

I have the following code for an Arduino sketch:

#include 

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
static FILE lcdout = {0} ;

static          


        
4条回答
  •  盖世英雄少女心
    2020-12-06 19:13

    From avr-libc documentation:

    If the full functionality including the floating point conversions is required, the following options should be used:

    -Wl,-u,vfprintf -lprintf_flt -l

    Note that if your MCU doesn't have any floating point support, you should try to avoid floating point operations completely. The floating point operations will be done in software which is very inefficient and needs a lot a flash memory.

提交回复
热议问题