Author, Date and Version Display

Hi All,

What's the best way to have an Author, Date and Version printed?

I want them all fairly high up in the file so when opened the data is easily visible when editing. The date will be a 'fixed release date' and I've got the versioning added by the follwing:

#define VERSION 100

Serial.print(F( "Software Version: ")); Serial.println( VERSION, DEC);

really dumb question but could I define the date as dd/mm/yy or would I have to use three defines for that - one for days, months, years? As for author I could just use initials...

Brain is a bit tired and trying to think of the best way to do this

You could use


I often use


too, because I always forget were I put my sketches.

Thanks for the reply - wouldn't that just print the current date though if a serial output is used for debugging? Or do I misunderstand that function?

It will print the date of the compilation.

Serial.println( VERSION, DEC);

The DEC seems to me to be superfluous

Additional information about those macros can be found here

i use what i call date-codes as version strings. todays' might be

const char *verison = "210520c";

where the letter is advanced for each version built today.

this not only uniquely identifies the code, but indicates when it was from. using version information has removed a lot of doubt over my career, often confirming that the code i'm looking at is actually the code i presumably just modified and built.

This is very close to what I am after, that's a great idea using the date and a suffix! I had not considered that.

I've still never stored 'words' in C, I'm assuming I could use

const char Author = "Author Name";

I'd probably have the originator/original author in the comments about the file but I would want to display the name of the person who updated the version (if that makes sense?)

You assumed ... wrong.

const char* Author = "Author Name";

(Can't store a string in a char - but the compiler already told you that)

Thanks for the general point in the right direction, I think I'm nearing the end of my quest as I think I might be able to store everything actually in an array for laziness...

char *versionInfo[] = {
  "Author: ", "Author Name", 
  "Version: ", "210520x", 

Then I could recall any bit that I want or just print in a loop like

for (int i = 0; i < 4; i++) {

That way the string code would be formatted fairly easily to understand.

don't forget to archive each (released) version in github.

1 Like