hello. im working on my robot again, and this time i wanted to have the button that controlled the servo previously directly control the led flash this time. is there a way to make the function loop until the down button is pressed?
task flash2;
task headlight;
task headlight()
{
while(true)
{
if(SensorValue[in1] > 400)
{
motor[port9] = 127;
}
else
{
motor[port9] = 0;
}
if(vexRT[Btn8U] == 1)
{
motor[port5] = 31;
}
else if(vexRT[Btn8D] == 1)
{
motor[port5] = -31;
}
else
{
motor[port5] = 0;
}
if(vexRT[Btn6U] == 1)
{
motor[port4] = 67;
}
else if(vexRT[Btn6D] == 1)
{
motor[port4] = -67;
}
else
{
motor[port4] = 0;
}
}
}
task flash2()
{
while(true)
{
if(vexRT[Btn5U] == 1)
{
SensorValue[dgtl1] = true;
wait1Msec(500);
SensorValue[dgtl1] = false;
wait1Msec(500);
}
else if(vexRT[Btn5D] == 1)
{
SensorValue[dgtl1] = false;
}
}
}
task main()
{
bLCDBacklight = true;
wait1Msec(10000);
displayLCDCenteredString(0, “Darkez 8.X”);
wait1Msec(10000);
displayLCDCenteredString(1, “ACTIVE”);startTask(flash2);
startTask(headlight);
startTask(flash2);
while(1==1)
{
motor[port1] = (vexRT[Ch1] + vexRT[Ch2])/2; // (y + x)/2
motor[port10] = (vexRT[Ch1] - vexRT[Ch2])/2; // (y - x)/2
motor[port2] = (vexRT[Ch4]);
motor[port3] = (vexRT[Ch4]);
if(vexRT[Ch1] || vexRT[Ch2] == 0)
{
SensorValue[dgtl2] = false;
}
else
SensorValue[dgtl2] = true;
}
}
heres my code. the selection i need help with is task flash2()