1

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?

4

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__);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.