Hi, can you put functions inside the task autonomous()? Because when I input my autonmous with functions into the task, it would give me errors.
Not put inside, but you canplace them ahead and call from your task. Such as:
void function1() {
...]
}
int function2() {
return 4;
}
task autonomous() {
int count = function2();
for (int i=0; i < count; i++) {
function1();
}
}
are there any specific function names that should be avoided? any that may cause problems with the competition?
- keywords, obviously (I vouldn’t try “void task() {}”, for example).
- conflicts with RobotC and Cortex APIs (sprintf, setMotorTarget)
- If you’d like to show your code to the judges, I’d avoid foul language