I need my sketch to print the name of the original INO file at the beginning of execution (during setup
).
Is it possible? If so, what is the resource which should be used?
asked May 28, 2019 at 16:39
1 Answer 1
You can use the macro __FILE__
to get the filename that is being compiled. That may not be your INO file, but may be some derivative of it.
Serial.println(__FILE__);
You also get some other handy macros:
__DATE__
The date the sketch was compiled
__TIME__
The time the sketch was compiled
__LINE__
The line number where __LINE__ is being used
The combination of __FILE__
and __LINE__
is commonly used for debugging:
Serial.prinln("Error 23 at line " __LINE__ " of " __FILE__);
answered May 28, 2019 at 16:40
lang-cpp