Sketch Name as Variable

Hello

Does anyone know if there is a way to insert the sketch name as a variable at the time of compiling?

I am working on 10 matching projects that are in different locations, and what I am hoping for is some way to put the sketch name (which includes our revision number) into a char array, so upon startup the name sketch programmed on the arduino would be printed to the lcd.

Thanks

I don't really know. Did you try __NAME__?

EDIT:
Almost there. XD Is the __FILE__ constant:
http://www.lemoda.net/c/line-file-func/

That might be it I will have to try it tomorrow when I get back to the office.

My new word of the day "preprocessor variable"

Thanks

preprocessor MACROS :smiley: (see the link)
But is OK, I understood the idea.

Every sketch I write includes this in setup():

  Serial.println(F(__FILE__ " " __DATE__ " " __TIME__));

It lets me see which sketch is loaded, and which version of the sketch. It would be relatively simple to display that text on a screen instead of printing it to the serial port.

PeterH:
Every sketch I write includes this in setup():

  Serial.println(F(__FILE__ " " __DATE__ " " __TIME__));

It lets me see which sketch is loaded, and which version of the sketch. It would be relatively simple to display that text on a screen instead of printing it to the serial port.

I like the idea.:slight_smile: