OK, so a couple of things.
The most important is to make sure you download the code for competition and then power cycle the cortex (only once is needed then it will be in competition mode). There is a bug in RobotC that causes the autonomous flag to toggle if the cortex is not in competition mode.
https://vexforum.com/attachment.php?attachmentid=5218&stc=1&d=1328473540
If you do not do this I see the effect you describe. This was not an issue in RobotC V2.32 last year, I had seen this before and think I had done a bug report but need to remind them. It may also be a master firmware issue rather than a RobotC issue. Anyway, get the cortex in competition mode and you should be ok.
secondly, a couple of bugs in the code.
I would change the name of e-stop to use an underscore rather than a minus, sometimes compilers will get confused and think you are trying to say “e minus stop” so use e_stop instead.
You also need a double == for a conditional compare. Also the touch sensor should be digital, you have it as an analog input, So the code would be
task kill()
{
while(true)
{
if(SensorValue[e_stop] == 0)
{
//do nothing
}
else
{
StopTask(auto);
StopTask(kill);
}
wait1Msec(10);
}
}
There also an extra “;” in the autonomous task, not really a problem but would be a source of confusion if you ever put code in the while statement.
So fix this so it looks like
while(True);
this
task autonomous()
{
StartTask(auto);
StartTask(kill);
while(True)
{
}
}
Let us know if this fixes your issues.
Edit:
I changed the touch sensor code again, I hadn’t realized it was setup as an analog sensor and then set it up as a digital input rather than a touch sensor (which uses reversed logic levels).
