I have been exploring the Ticker libraries for use on either ESPs or UNOs
Although both use a file named Ticker.h they are completely different but seem to be allowed to co-exist in the IDE files and have entirely different example files.
When I use a ESP8266-01 the ESP code from the following site compiles and runs OK
but the same example files supplied with this library will not run on a UNO.
Likewise when programming a UNO I use the following Ticker library GitHub - sstaub/Ticker: Ticker library for Arduino but the example code within although calling up Ticker.h will not run on a ESP although both are installed in the IDE.
I suppose this confusion could have been avoided by say the ESP version be called TickerESP.h by the author, not that I'm blaming them as I appreciate their efforts.
Maybe in the ESP code I could just rename the .h file and all reference to in any code a write, would that work?
What I want to do is write code using Ticker that is portable on original UNOs as well as ESP. Don't want to change code / libraries when I change hardware.
If you want GitHub - sstaub/Ticker: Ticker library for Arduino to always be used for Uno and for ESP8266 then you can accomplish that by adding a library.properties file to the library, which will cause it to have include priority even when compiling for ESP8266. I can give you more information on this if that's what you're trying to accomplish.
#ifdef ESP8266
// code using https://github.com/esp8266/Arduino/tree/master/libraries/Ticker API here
#else
// code using https://github.com/sstaub/Ticker API here
#endif
Thanks pert for your guidance / comments. I'm going to study the following tutorial that may assist me further in understanding 'preprocessors etc' after which I may refer back to your advice.
Looks like a good overview, which even contains an example similar to what I suggested.
One thing I didn't notice it mention, which is very important, is that you should only use the preprocessor directives when there is no other good option. If you start unnecessarily using this stuff it will make your code extremely difficult to debug and understand, especially if you abuse function macros.