larseh created page: Lesson10Week14 authored by Lars Eriksen Høeg's avatar Lars Eriksen Høeg
......@@ -126,6 +126,7 @@ The legocar has same physical design as in the experiments described above.
A simple solution would be to use a sequantial loop if we know the position of the obstacle. Such a solution could be like this where we use a predetermined route[PilotAvoid]:
public void go()
{
LCD.clear();
......@@ -133,8 +134,8 @@ public void go()
while ( ! Button.ENTER.isDown()) Thread.yield();
Sound.twoBeeps();
LCD.drawInt(sonar.getDistance(), 2, 2);
pilot.travel(50, true);
while(pilot.isMoving()){
if(sonar.getDistance() < 10){
......
......