Trouble with repeat until


#1

I’m just starting out trying to program my Ranger. I’m running mBlock 3.4.10. If I put in:

this is the relevant part of code it generates:

while(!((ultrasonic_10.distanceCm()) > (30)))
{
    _loop();
    moveDegrees(4,5,100);
}

Shouldn’t the _loop() be after moveDegrees? Wouldn’t _loop coming at the start cause the code below to never run? If I have a fundamental misunderstanding of how this code works just let me know.


#2

Hi kevin52408,

First, the 5 degrees may be too small so that the motor won’t turn.
Besides, you may add a forever loop like example below: