larryd:
“Sorry, I can't include the sketch for contractual reasons....“
Sorry, we cannot help you then.
If I don't own the copyright, I cannot post, but I thought the questions was genuine.
larryd:
Okay maybe we can.
What happens when you compile the sketch ?
?
And in my first post I said the sketch compiles and runs fine...
larryd:
If you don’t like RED put a capital S on seconds.
Which is exactly why I asked the question in the first place. "seconds" is "known" to the compiler, so it highlights it, but why, and where do I find a list of "reserved" words the compiler might have issues with.
In this particular case it didn't seem to matter, but are we saying that the programming language we use in Arduino IDE is in fact a much wider spectrum than the Reference dips into ? In other words, the language is C++, and the "Reference" is just for starters?
daba, this problem annoys me too. I just change a character or add some more characters to make the word different. I am pretty sure that if you did use an already reserved word (maybe it appears in a library for example) then you'd get a compiler warning to the effect you are declaring the same variable twice.
As for not posting code, in this case it does not matter, however, please consider in future that if you will not / cannot post your code for whatever reason then the help you will get will be very limited if you get any at all. Just as you don't have to post your code we don't have to help.
If you cannot post your code, or the code is overly long and complex, then the general solution is to write a small bit of code that demonstrates the problem and post that.
In this particular case it is not that important, because typing seconds into a completely empty sketch will still highlight it in red. It appears the IDE is reading in all the library keyword.txt files regardless of whether the library is used or not.
TomGeorge:
Hi,
second is highlighted, seconds is not.
second is highlighted in a new sketch with no libraries or functions.
Tom...
It depends on which libraries you have installed, even if you are not using them in the sketch. I get both second and seconds because second is used in the Time and RTClib libraries, while seconds is used in RTClib and Adafruit_GPS_Library. My observation is that the IDE processes all the keywords.txt files when it opens, and then highlights the keywords regardless of whether or not the library is being used. If I move the applicable libraries out of the Arduino/libraries folder and restart the IDE then the highlighting no longer occurs.
Multiple library spaces would make my life much easier - I've resorted to developing on multiple machines so I can keep certain things separate. There are so many problems with the simplistic way it's implemented. This is one of them.