The think the loop is slightly wrong...
Basically, I think you need a flag to indicate that the bot should be moving, so that when you clap, it flips the flag...
boolean move = false;
do {
if ( sound.readValue() > 50 ) {
move = !move;
}
while ( sonic.getDistance() > 30 ){
Motor.B.backward();
Motor.A.backward();
Motor.C.backward();
}
if (move) {
Motor.A.rotate( -185, true );
Motor.C.rotate( 185, true );
}
} while( Button.readButtons() != Button.ID_ESCAPE );
Or something similar. Otherwise, it will only move when there is another sound
I'd also just like to say, I'm very jealous ;)