Main scope level

The following statement is marked with a red x: void waitForRelease()
Compiler Error states: *Error : Functions must be defined at main scope level

Any ideas on how to fix?


Are you trying to declare this function inside of another function? It would help if we could see the code.

Are you declaring your function in

task main() {}

? It should be defined outside of there.

How would I define this outside of task main?

Function header and body outside task main, like this:

// motor/sensor setup blah blah blah

void waitForRelease() {

task main () {