Something
public text v1 · immutabletask track() {
while (true) //don't let loop break out
{
if ( (SENSEL < value + 50) || (SENSER > value + 50 ) ) //if both sensors are within the range of the 60 watt bubl
{
SetPower(MOTORL, 7); //again this speed makes the bot go kinda straight
SetPower(MOTORR, 7);
OnFwd(MOTORL+MOTORR); //move the bot
//start findGreatLight;
while(true) //don't let the loop break
{
OnFwd(MOTORR + MOTORL);
if ( (abs(SENSEL - SENSER) < 10) ) {
if(SENSEL > SENSER) {
SetPower(MOTORR, 7);
SetPower(MOTORL, 7);
Wait(100);
Off(MOTORL + MOTORR);
Wait(50);
continue;
}
else if(SENSER > SENSEL) {
SetPower(MOTORR, 7);
SetPower(MOTORL, 7);
Wait(100);
Off(MOTORR + MOTORL);
Wait(50);
continue;
}
else {
SetPower(MOTORR + MOTORL, 7);
Wait(100);
Off(MOTORL+MOTORR);
Wait(50);
continue;
}
}
if ( (SENSEL < 540) || (SENSEL > 610) ) //if the bot is really close to the light then
{
Off(MOTORL+MOTORR); //turn bot off
PlaySound(SOUND_UP); //play a nice sound
Wait(300); //wait for the score
PlaySound(SOUND_UP); //play a nice sound
SetPower(MOTORL + MOTORR, 7);
OnRev(MOTORL + MOTORR);
Wait(100);
start restart;
}
}
}
}
}