Auto-generate a version number

This is a quick post about a method that can be used to get the preprocessor to do the job of generating a self incrementing version build number. This can eliminate a potentially boring repetitive task if you’re currently doing it in some manual way. The trick described here uses the built in __DATE__ and __TIME__ GCC preprocessor macros.

Inquisitive types can read more about these macros here.

Here’s the sample code for the method described: https://github.com/jjssoftware/autoVersioning. There’s not a lot of code and it’s probably quickest to just have a quick read and dive straight in.

This method will work on both esp8266 arduino core and regular arduino projects. Enjoy!