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?

asked May 28, 2019 at 16:39

1 Answer 1

5

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
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.