I have a strange problem about where a function is placed in a sketch.
I have one void function which is located along with all the other global functions after the void setup() and void loop() functions and is called in the void loop().
The sketch errors with "'blinkLED' was not declared in this scope". (The function is listed further down.)
The really weird thing is that when I move this single function to before the void setup() function, leaving all the other global functions after the void loop() function, then all is well and the sketch compiles.
Is the location of global functions important? I have never found that to be the case before.
/////////////////////////////////////////////////////////////////////
// blinkLED
/////////////////////////////////////////////////////////////////////
void blinkLED( byte colour, int lOn = ledOn, int lOff = ledOff) {
// This will blink a specified LED for defined on and off periods
if (ledStatus) {
if (millis() > ledMillis) {
lowerLED();
ledMillis = millis() + lOff - lOn;
ledStatus = !ledStatus;
}
} else {
if (millis() > ledMillis) {
raiseLED(colour);
ledMillis = millis() + lOn;
ledStatus = !ledStatus;
}
}
}