Well, I think it's kind of stupid to open a whole new thread just to ask a very simple and stupid question on the Webbotlib so let's make this a place to ask newbie question (Maybe Webbot can use this thread to update the FAQ section on his Webbot's manual)
Ok, here's the main part, my question:
In my traditional WinAVR program (without Webbot), I usually create several variables inside the main() function (but outside the while loop) I thought that the function "appInitSoftware" in Webbotlib was supposed to have the same function but turns out that it's not (obviously) so what I've been doing when I wanted to create a new variable is to put it outside of every function like this:
#include "hardware.h"
volatile boolean previouslyReleasedButton1=1;
volatile boolean previouslyReleasedButton2=1;
DUTY_CYCLE dutyRight = 85;
DUTY_CYCLE dutyLeft = 100;
int i;
// Initialise the hardware
void appInitHardware(void) {
initHardware();
}
// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
pin_low(leftMotorEnable); // Turn on left motor
pin_low(rightMotorEnable); // Turn on right motor
return 0;
}
// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) {
.....
I know it's the wrong way to do it but, then, what is the correct way?