目次 [ Contents ]
Since it occurs irregularly, I could not understand the cause, but there are some case that it can not be compiled with “correct syntax” on Arduino IDE. The reason why I can tell it is not wrong is because “sketches that were being compiled ordinary, before”.
It occurs when sketching to organize functions by making tabs, or copying functions from other sketches for progressing one.
A warning on IDE tells me in red, “function is not defined”. It can’t be ! Because I have already succeeded compile before. But such symptoms come out often after upgrading IDE, although I do not clear which version is.
If the error has appeared, I was giving up as a bug and I made it again. But one day, I learned that it can be avoided by simply changing the order.
Describe function before using in the function
Many reference Sketches are written in the order of “Definition of variables etc”, “setup” function, “loop” function, “other functions you created yourself”. So I have written according to it.
For example, if you make some functions like HOP(), STEP(), JUMP(), on a sketch,
There were no problems on the sketch before. But On some new versions of IDE, this sample may be refused, in other words,
It is order that write referenced function before function you use on it.
It is common to make #define Constants and variables before use it. However, functions may has become same as it ? By the way, useful “tab function” on IDE is the same thing written from the left tab in order, so you need to be careful.
I do not know if IDE version upgrade made this rule or whether it is common rule to write code like this. One thing I can say is that there are times when “compile” can be “possible” and “not possible” due to this factor.
Anyway, my abandoned sketches could be revived. And it is only a simple problem of writing order, I should get used to writing style “like this”.
On this site, the cases may have been occurred for particular circumstance, despite of that I had been confirmed sample sketches before publishing. If you encounter this problem, try change order of functions. And I hope you will leave a comment when the problem happens to you.