This post is just for general information. No need to reply:
In the Arduino Libraries generated by Edge Impulse the Static_Buffer example uses both Serial.print
and ```ei_printf```
Serial.println("Edge Impulse Inferencing Demo");
}
/**
* @brief Arduino main function
*/
void loop()
{
ei_printf("Edge Impulse standalone inferencing (Arduino)\n");
Through a fair bit of trial and error, it looks like ei_printf
is for character arrays or more specifically a “const char* s_variable” whereas Serial.print
is the more regular Arduino print function. It also looks like these print commands can be used interchangeably, if so, why is ei_printf
used?
ei_printf
like “printf” allows for specific formatting codes that have been around for ages, whereas Serial.print originally didn’t do formatting terrible well.
Now-a-days Serial.print
is fairly powerful, the following complex lines are interchangeable:
// ei_printf(" %s: %.5f\n", result.classification[ix].label, result.classification[ix].value);
Serial.println(" " + String(result.classification[ix].label) + ": " + String(result.classification[ix].value, 5) );