Again, thank you for the help
Quote:
No that wont work because it will only execute the auton once for a fraction of a second (26.2 ms to be exact) because the next time the automationhasrun = 1 so it wont run again;
DON'T DO THIS BECAUSE YOU DON'T HAVE CONTROL OVER IT.
|
But if I did use the variable, wouldn't it ensure that the subroutine just runs 1 time and never again until the robot is powered on? If I wanted a subroutine to run just one time in default_routines, would this need be used?
Code:
while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */
/* Add your own autonomous code here. */
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
Like here won't it continuously loop the Auto code(An any subroutines in it) until it realizes 'hey, I am not in auto mode anymore'?
And what does the generat_pwms part do? Aren't they already initialized?