void ei_printf_float(float f);

Brief: Override this function if your target cannot properly print floating points. If not overriden, this will be sent through ei_printf().

Location: edge-impulse-sdk/porting/ei_classifier_porting.h

Blocking: Depends on user implementation

ei_printf_float() is declared internally in the Edge Impulse SDK library, and the function must be defined by the user.

Some platforms cannot handle directly printing floating point numbers (e.g. to a console or over a serial port). If your platform cannot directly print floats, provide an implementation of this function to print them as needed (for example, construct a string containing scientific notation with integers and call ei_printf()).

If your platform can print floating point values, the easiest implementation of this function is as follows:

__attribute__((weak)) void ei_printf_float(float f) {
    printf("%f", f);

Note the __attribute__((weak)) symbol, which means that a user could override the implementation elsewhere in the program.


  • f - [input] Floating point number to be printed.


  • This Arduino example demonstrates how to implement this function on a platform that can print floating point values.
  • This STM32 example demonstrates how to implement this function on platform that cannot print floating point values.