Store sketch version while compiling?

Is there a way to read and store the sketch name while compiling and making this info available for the program once the arduino boot-up? For example to report the name in the serial terminal or to store it on a SD card for referencing?

thank you

Serial.println(__FILE__);  // Tell me the name of the file that was compiled to make this - useful version check. 

Thank you! exactly that.

You can use some more

void PrintFileNameDateTime() {
  Serial.println( F("Code running comes from file ") );
  Serial.println( F(__FILE__) );
  Serial.print( F("  compiled ") );
  Serial.print( F(__DATE__) );
  Serial.print( F(" ") );
  Serial.println( F(__TIME__) );  
}

using the F-macro safes RAM

best regards Stefan

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.