Programming Suggestion

Because I have multiple devices (UNOs and various clones, ESP modules, STM board etc.), I've started using this little bit of code to keep track of what they have been programmed with.

// DW to keep track of code versions etc.
String compiled = "";
String filenm = "";
String deviceName = "";

// the setup function runs once when you press reset or power the board
void setup() {
  // DW to print filename and date/time compiled
  delay (2000); // wait for uart to settle
  filenm = __FILE__ ;
  compiled = __DATE__ ;
  compiled = compiled + " " + __TIME__ ;
  Serial.print("Complied at ");
  // start your 'original' sketch here, remember that you have already setup the serial port above,
  // no need to do it again.

OUTPUT on Serial monitor is like this:

Complied at Oct 20 2016 06:19:28

Hope this helps someone.

Why use String?

void setup() {
  Serial.println(F("Compiled at " __DATE__ " " __TIME__));
void loop() {}

saves a bunch of memory.

compILed 8)


Thanks. That is a quite useful thing. I'm considering a method to manage all related information of the uploaded program likes version, date, default parameters, change logs...

Anyone suggests another method should be used. Thanks

At work, I have a pretty complex java project. I use git to tag versions, ant to build it, and there is an ant task 'gitant' that knows how to talk to git. The result gets stamped with a version and environment (DEV/TEST/PROD), or if the git directory is "dirty" it gets stamped as being an incremental build.

Seeing as the IDE is java based, and ant is just java, it might be possible to re-engineer it so that it generates a build.xml for the project and internally uses ant to do the build. Modifying that build.xml would let you do stuff.

Maybe if the IDE had a button that would spit out the build steps as a script.

Alternatively, maybe there's already a page on this site that explains what the IDE does in a build in such a way that you could write a script to do what it does. You could then hack up that script.

Hi PaulMurrayCbr. Your suggest is great. But this seems to be out of my ability. Thanks