Take Spoke Code
public static void takeSpoke (int n){
int spokesPassed=0;
while(true){
//get off the current line:
while(Sensor.S2.readValue()
Motor.A.backward();
Motor.C.backward();
}
//rotate until we've found the next line:
while(Sensor.S2.readValue()>DARK){
Motor.A.backward();
Motor.C.backward();
}
spokesPassed++;
//we've found the path to take
if (spokesPassed==n){
//move forward until we've cleared the intersection
while(sensor.s1.readValue()>DARK && sensor.S3.readValue()>Dark){
Motor.A.forward();
Motor.C.backward();
}
state=CENTER_ONLY;
return;
}
}
}